Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

219.Text file parser -- How to extract the 3rd to 6th characters of the second word of the 2nd line in a lot of text file and save them together to a new file?

User: editor -- 2008-07-11          << 218  220 >>
Hits: 439
Type: Text file parser   
Search all Text file parser examples
Description:
How to extract the 3rd to 6th characters of the second word of the 2th line in a lot of text file and save them together to a new file?
Input Sample:
=============
File1:
12345 006789
22345 --A001----
3234567 23456
...
=============
File2:
234 5 23534 0345
34534543 --A002----
24323 2343243
....
Output Sample:
output.txt:

A001
A002
...
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-h open 'Replace' dialog

* in 'Replace' page:
set 'Replace Unit' to 'word'
set 'Replace Scope' to 'Line'
set 'unit number filter' to 2(means 2nd word)
set 'Search for pattern' to:

set 'Replace with pattern' to:

uncheck options of [ ]Print unmatched Unit

* Select 'Scope Filter' page:
set 'Line Number Filter' to 2(means the 2nd line)

* change the '>' to '>>' at the left of output file entry.
(means append result to result.txt)

3. click 'Batch...' to open 'Batch Runner' dialog
click 'Pick Files' to pick multiple files
enter a fixed name in set output filename entry like:
 and click 'Apply' at right.

4. click 'Batch Replace', all required data will be put to result.txt
Download Script:  scripts/219.rst.zip

Similar Examples:
How to extract titles of all html files and save them to one file? (56%)
How to extract first line from multiple files and generate a new file? (55%)
How to replace the second character of every line to 4 in a text file? (53%)
How to extract the line 2-9, 12-19, 22-29, ...of a text file and save to multiple files? (50%)
How to sort the lines in a text files by the order of line length? (49%)
How to remove the first 10 characters of each line in text file? (49%)
How to replace the second character of every line to 4 in multiple files? (49%)
How to extract half of lines from a text file randomly? (48%)

Check Demo of Text file parser
Keywords:
3rd  2nd  together  scope filter  pages  fixed  toc  append  second  ppen  the 6th  pick characters line  fixed number  parser extract left  append a number to a filename  extract line number  pick characters  extract all line word