cat file_1.txt
100 200 name
100 200
100 200
150 300
150 300
150 250
150 250
150 300 name
final file should be
150 300
150 300
150 250
150 250
i am using this command
cat file_1.txt | grep -v "name">file_2.txt; cat file_2.txt| while read line;do cat file_1.txt| grep "$line"| head -1|grep -v "name" ;done
but data is too much cant use while loop it is taking to much time cat use while loop . is there any other way to do it fast
like using "grep -vf file_1 file_2"
something like that By passing like that . please let me know.
here i am using the logic of getting the top most line of pattern found pattern is every line of "file_1.txt"
code tags
when posting code. Also, it would be helpful if you could rephrase your question; because in its current state it is very hard to understand what it is you want to achieve. – Sep 26 '16 at 06:17