Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ How to remove last character (:) on every line

In Notepad++ how can I remove : at the end of lines like this

FRUIT:SHOP:TBA0002:RACK 01:LINE 1:TOP:MAX:1602:1612:

So it will become like this

FRUIT:SHOP:TBA0002:RACK 01:LINE 1:TOP:MAX:1602:1612

I have a very large list which consists of around 3000 lines.

like image 423
user3286046 Avatar asked Feb 08 '14 01:02

user3286046


People also ask

How do I change the end of a line in notepad?

In Notepad++, press Ctrl-H (Replace...). In the Replace dialog box, click Extended under Search Mode. In the "Find what" box type !\ r and in the "Replace with" box type \r.

How do I remove the first character from every line?

Press and hold down ALT. Click and hold down mouse button and select the first character of every line, and release. Press the DELETE key.


3 Answers

You can use a regular expression at the replace dialog.

Find:

.{1}$

Replace with nothing then just select Replace All

Full options are:

enter image description here

like image 178
Charles P. Avatar answered Oct 19 '22 09:10

Charles P.


From the manual Regular Expressions page, it states

Notepad++ regular expressions use the Boost regular expression library v1.70, which is based on PCRE (Perl Compatible Regular Expression) syntax

So, you must simply search for a regular expression

:$

and replace this with nothing.

The dollar sign $ denotes the end of line.

For more on regular expressions, see the Notepad++ manual link above or http://www.regular-expressions.info/.

like image 28
Olaf Dietsche Avatar answered Oct 19 '22 11:10

Olaf Dietsche


Use find and replace, check the extended option, look for :\r\n and replace with \r\n. This will remove them all except for the last line.

like image 6
Kalin Varbanov Avatar answered Oct 19 '22 10:10

Kalin Varbanov