I am using the grep -f function to extract lines from a file which match a particular pattern. Let's say my pattern file is pattern.txt, as follows.
1 2 3 4 5 And the file against which I am matching this pattern is file.txt,
1::anv 2::tyr 3::yui 4::fng 5::gdg 6::ere 7::rer 8::3rr 9::gty Now when I do a grep -f pattern.txt file.txt, I am getting this ->
1::anv 2::tyr 3::yui 4::fng 5::gdg 8::3rr The last line in the output above, is causing my problem. How do I modify this grep command so as to get the output (showing correct correspondences) as follows?
1::anv 2::tyr 3::yui 4::fng 5::gdg
more patt.txt" file.txt | awk -F '::' '{ print $1 " "$2}' But this also gives me the same problem.