Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

466.Regular expression replace -- Is there any way to strip/add the line number at the beginning of each line?

User: editor -- 2010-04-03          << 465  467 >>
Hits: 1995
Type: Regular expression replace   
Search all Regular expression replace examples
Is there any way to strip/add the line number at the beginning of a text file?

I want to strip(remove), or add(insert) the line number at the front of each line, and vice versa.
Input Sample:
1 advance search and replace
2 regular expression replace
3 search replace binary files
Output Sample:
advance search and replace
regular expression replace
search replace binary files
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
To strip the line number before each line:
1. ctrl-o open source text file
2. ctrl-h open 'replace' dialog
* set 'replace unit' to chars
* set 'replace scope' to line
* in 'search for pattern', enter:

3. click 'Replace', done!

For the question about how to add line number for each line, please refer to following page:
Download Script:  scripts/

Screenshot 1:  Replace_Window

Similar Examples:
How to add a line number at the beginning of each line? (79%)
Is there a way to add a fixed line before each line of text? (68%)
How to move a string from the end of the line to the beginning of the line? (63%)
How to sort the text file by the date at the beginning of each line? (61%)
How to insert a word or phrase to the begining of each line? (61%)
How to change multiple files, adding filename at the beginning of each file? (59%)
How to delete all blank/space at the beginning of each line? (57%)
How to batch insert filename at start/beginning of each lines? (55%)

Check Demo of Regular expression replace
strip  about  question  before each line  refer  add line number  before  bef  befor  mind  how to add a line in front of a  add before each line  before a number  add before line  replace before line  line before  add to beginning  add text beginning