Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

777.Text file parser -- How to extract the first 10 and last 10 characters from each line?

User: editor -- 2011-05-10          << 776  778 >>
Hits: 393
Type: Text file parser   
Search all Text file parser examples
Description:
How to extract the first 10 and last 10 characters from each line in a text file? Like excel function left and right.
Input Sample:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Output Sample:
ABCDEFGHIJQRSTUVWXYZ
ABCDEFGHIJQRSTUVWXYZ
ABCDEFGHIJQRSTUVWXYZ
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open source text file
2. ctrl-h open 'replace' dialog
* set 'replace unit' to 'Line'
* set 'replace with pattern' to:

3. click 'replace', done!

Hint:
chars(text,1,10) is equivalent to excel function left(text,10)
chars(text,-10,-1) is equivalent to excel function right(text,10)
chars(text,3,8) is equivalent to excel function mid(text,3,6)

Screenshot 1:  Replace_Window


Similar Examples:
How to remove the first 10 characters of each line in text file? (70%)
How can I add a word before the last 10 characters of each line? (68%)
How to add first line to the start of each line? (67%)
How to extract all lines with more than 30 characters from multiple files? (64%)
How to reverse the order of characters in each line of text? (64%)
How to extract the text between first comma and second comma in each line? (63%)
How to add a space after the 15 character of each line? (63%)
How to limit a text file to less than 40 chars each line? (62%)

Check Demo of Text file parser
Keywords:
101  excel  first 10  toc  function  last  right  las  characters  file parser  extract first 10 characters from file  extract first 10 characters text file  replace 10 first characters  extract function parser  extract last line  parser extract left  extract last  replace first characters in a file