Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

201.Advanced search and replace -- How can I add a word before the last 10 characters of each line?

User: editor -- 2008-06-24          << 200  202 >>
Hits: 385
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How can I add a word before the last 10 characters of each line?
Input Sample:
line 1 is abcdefghijklmnopqrst
line 2 sample ABCDEFGHIJKLMNOPQRST
line 3 aaaaaaaaaaaaaaaaaaaaaa
Output Sample:
line 1 is abcdefghij(added text)klmnopqrst
line 2 sample ABCDEFGHIJ(added text)KLMNOPQRST
line 3 aaaaaaaaaaaa(added text)aaaaaaaaaa
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. press ctrl-o open source file
2. press ctrl-h open 'Replace' dialog
in 'Replace' page,
* set 'Replace unit' to 'Line'
* set 'Search for pattern':

* set 'Replace with pattern':

3. click 'Replace', done.

Note: chars($match,1,-11) means 1 to -11 characters of matched line
chars($match,-10,-1) means -11 to last characters of matched line
** -10 means the 10th characters count from end of line.
Download Script:  scripts/201.rst.zip

Screenshot 1:  Replace_Window


Similar Examples:
How to extract the first 10 and last 10 characters from each line? (72%)
How to add a space after the 15 character of each line? (69%)
How to add a word "myword" at the end of each line? (65%)
How to remove the first 10 characters of each line in text file? (64%)
How to add first line to the start of each line? (59%)
How to remove every other characters on each line of text? (58%)
How to add all numbers by 30 after symbol ":" in each line ? (58%)
How to replace the characters in fixed position in each line? (58%)

Check Demo of Advanced search and replace
Keywords:
101  before  last  end of line  count  las  characters  chars  character  end  add last word  replace the last word for each line  each line last word  before word  last line last word  add before each line  count characters  add before line