Tag Archives: notepad++

Notepad++ Quick Trick #2 – Adding Line Breaks

My Quick Trick #2

Since you are editing text in Notepad ++, and you have already used Quick Tip #1 to mark specific lines of code, say containg <span> you might need to break the whole line in two lines so that a new line break forms after the <span> part of the code.

From this:

More Html Code here <span>Santa is Coming</span> More Html  Code here

To This:

More Html Code here <span>
Santa is Coming
</span> More Html  Code here

An easy way to do this by using the search and replace menu of notepad ++ . You need to seach for a part of the code where you want the break to occur, and then replace for the same part adding the escape sequence of the line break “\n” at the end. Make sure you have enabled “Extended Search Mode” at the bottom of the search window.

Adding Line Breaks

Additional Espace Sequences can be used in the same way:

 \" – double quote
 \\ – single backslash
 \a – bell/alert
 \b – backspace
 \r – carriage return
 \n – newline
 \s – space
 \t – tab

Nice?

 

Notepad ++ quick Trick #1 – Marking specific lines in code

Notepad ++ is my preferred text/ php/html/python editor, and, since some time i have been discovering all the nice things and automations you can do with it. I will be posting updates for notepad ++ automation and tricks, primary because its so hard for me to remember all of them. 🙂

Here it goes:

Trick #1

I some times need to scrape html code to specific tags or image urls. I found that this can be easily done using the search option of the Notepad++ and the “Mark” tab.

“Mark” basically bookmarks any line that has the search term in it. After you bookmark all the lines with “<span>” for example,  then you can go to Search> Bookmark>Remove Unmarked Lines  to remove all the parts of the code that do not contain the search term and of course are not needed. Nice?

$’\r’: command not found

I usually crate my scripts on my windows everyday computer and upload them to my unix- bash running pc. Many times i get the error :$’\r’: command not found

This is caused by the “CRLF” End  of File for windows, which unix unfortunatelly does not like.

To correct this, open the script using Notepad++ and navigate to Edit>EOL Conversion>Unix(LF)

LF Notepad ++

And then retry the script.

This automatically converts all CRLF to LF. nice hah?