Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1340.Text file parser -- How to extract the first and last lines where the second column is the same?

User: Verotiana -- 2016-02-16          << 1339  1341 >>
Hits: 2585
Type: Text file parser   
Search all Text file parser examples
Description:
Extract the first and the last lines where the second column is the same.
Input Sample:
14:55:22.811213, 1545, F, R, C, , , , , , , , , , , ,  
14:55:22.820213, 1545, F, R, C, B, , , , , , , , , , ,  
14:55:22.910213, 1545, F, R, C, B, , , , , , , , , , ,  
14:55:22.935213, 1545, F, R, C, B, , , , , , , , , , ,  
14:55:22.960213, 1545, F, R, C, B, , , , , , , , , , ,  
14:55:22.985213, 1545, F, R, C, B, , , , , , , , , , ,  
14:55:23.997214, 1469, G, R, F, , , , , , , , , , , ,  
14:55:24.013214, 1469, G, R, F, C, , , , , , , , , , ,  
14:55:24.027214, 1469, G, R, F, C,  
B, 
Output Sample:
14:55:22.811213, 1545, F,R,C, , , , , , , , , , , ,  
14:55:22.985213, 1545, F, R,C,B, , , , , , , , , , ,  
14:55:23.997214, 1469, G,R,F, , , , , , , , , , , ,  
14:55:24.043214, 1469, G, R, F, C, B, R, , , , , , , , ,  
14:55:24.806215, 1546, F, R,C, , , , , , , , , , , ,  
14:55:24.844215, 1546, F, R, C, B, R, , , , , , , , , ,  
 
 
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 'Paragraph' 
* set 'replace with pattern' to: 
 
* click 'settings' page: 
* set 'para start' to 'other': 
 
* set 'para end' to 'None' 
3. click 'replace', done.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Settings_Window


Similar Examples:
How to remove all but first lines whose second column is bigger than 6? (66%)
How to extract column X from csv file where X is decided by column A? (62%)
How to extract all lines that has more than 4 columns from csv file? (61%)
How to extract the text between first comma and second comma in each line? (58%)
How to extract all lines that contain words in a list? (57%)
How to rename files to the first and last line of file contents? (57%)
How to extract the second column from a database text file? (57%)
How to extract specified lines in different section of text file? (56%)

Check Demo of Text file parser
Keywords:
previous  last lines  second column  non  last line  paragraph  paragra  same  second  settings  extract first column  extract last lines  extract lines last  extract text start with and end with  extract words to column  first and second words  extract last  extract column