Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1368.Text file parser -- How to extract and join first words from adjacent lines?

User: user -- 2016-05-23          << 1367  1369 >>
Hits: 2937
Type: Text file parser   
Search all Text file parser examples
Description:
There are many lines in a text file, in which each word is separated by #### in the  
line. How to extract the first word and the first word of the following line.
Input Sample:
a111####b111####c111 
a222####b222####c222 
a333####b333####c333 
a444####b444####c444
Output Sample:
a111####a222 
a222####a333 
a333####a444
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open text file 
2. ctrl-h open 'replace' dialogue 
* set 'replace unit' to 'Line' 
* set 'unit number filter' to:  
* uncheck 'print unmatched units' option 
* set 'replace with pattern' to: 
 
3. click 'replace', done 

Screenshot 1:  Replace_Window


Similar Examples:
How to extract different part from adjacent lines? (75%)
How to split a text file according to first word in each line? (65%)
How to extract lines containg specified words from many files? (62%)
How to extract all lines that contain words in a list? (62%)
How to extract lines with specific words in first column? (62%)
How to extract the first 10 and last 10 characters from each line? (61%)
How to extract all upper cases words from a text file? (61%)
How to replace the all word "test" with the first word in same line? (61%)

Check Demo of Text file parser
Keywords:
adjacent lines  adjacent line  adjacent  previous  first words  separate  first word  unit number filter  number filter  unmatched  extract lines from text file by filter  extract first number in the line  extract first number from a line  extract line by number  extract lines text file line number  extract lines from word  replace with previous line  extract line number