Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1322.Advanced search and replace -- How to remove all but first lines whose second column is bigger than 6?

User: Dilip -- 2015-11-07          << 1321  1323 >>
Hits: 2511
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to prevent header of text file, that is the first line, from getting  
deleted. I want the header to be retained after replacement. 
 
Example: 
$match[2]>6 then delete all file but header also gets deleted when the number  
in second column is less than 6
Input Sample:
1 7 2 8 5 
2 8 2 3 4 
3 6 1 2 3 
4 9 5 5 5
Output Sample:
1 7 2 8 5 
3 6 1 2 3 
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 'if' to: 
 
3. click 'replace', done.

Screenshot 1:  Replace_Window


Similar Examples:
How to extract the first and last lines where the second column is the same? (64%)
How to remove all lines that contains more than one word? (59%)
How to remove lines where the last column does not match column 4? (58%)
How to remove all duplicated lines without considering the last word? (57%)
How to move all files whose names are ended with numbers to another folder? (55%)
How to remove all lines whose 4th column enclosed by a pair of parenthesis? (55%)
How to remove all the lines that with odd line number for multiple files? (55%)
How to remove all lines with duplicate value in column B in CSV file? (54%)

Check Demo of Advanced search and replace
Keywords:
big  header  even  replacement  less  second column  delete all  second  after  example  remove text after second  delete second column  remove second line  remove lines from text less than  delete line after  remove line less than  replace file header  less than lines