Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1202.Text file parser -- How to extract all lines in which first 2 columns are identical?

User: Chao Tan -- 2014-05-05          << 1201  1203 >>
Hits: 1255
Type: Text file parser   
Search all Text file parser examples
Description:
In the text,there were 2 IDs for each line in the head.I want to compare two id of the same line and reserve the line that have two same id(or just delete line with two different id).

Thank you for your help and sorry for troubling you.
Input Sample:
TU1 TU1 100.00 99
TU1 TU765 100.00 380
TU2 TU2 100.00 172
TU4 TU4 100.00 198
TU5 TU5 99.38 650
TU5 TU6 100.00 146
TU5 TU49988 91.48 176
Output Sample:
TU1 TU1 100.00 99
TU2 TU2 100.00 172
TU4 TU4 100.00 198
TU5 TU5 99.38 650
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 'search for pattern' to:

* set 'replace with pattern' to:

* uncheck option of 'print unmatched unit'
3. click 'replace', done.

Screenshot 1:  Replace_Window


Similar Examples:
How to append the second columns of file A and B if first columns are identical? (65%)
How to extract lines with specific words in first column? (64%)
How to extract all lines whose line numbers are multiple of 3? (64%)
How to extract 3 lines from each file randomly? (61%)
How to extract all lines in which the first character is the same as last character? (61%)
How to batch append the columns of file A and B if third  columns are identical? (60%)
How to extract all lines that has more than 4 columns from csv file? (59%)
How to extract half of lines from a text file randomly? (58%)

Check Demo of Text file parser
Keywords:
reserve  identical  compare  comp  help  extract all lines  two  pare  same  columns  delete two columns  delete first two  delete the same line  line compare  text compare  compare file  file compare  delete columns in text file