cat file_1
my colour is red
my rose is red
my colour is blue
my rose id blue
cat file_2
red
blue
cat output_file should be
my colour is red
my colour is blue
here i am using
cat file_2 | while read line;do cat file_1 | grep "$line" | head -1;done
here i am trying to get the top most line containing the pattern "red" and "blue"
which is present in the file_2
is there any other way to do , as fast as possible
, while loop is taking time
cat
processes into the solution? – Kaz Sep 27 '16 at 20:43