How to grep file by another file's line using bash -
the file1 store sentence want grep,here 's content file1
.|||anymore . ,|||arguments ,|||atheists ,|||be ,|||because .|||because
the problem it contain space in sentence , , target file2 contain space too, how can search file2 content know whether file2 has these sentence in file1 or not
if found output grep result anther file(append) ,if no found output file keep it
try this-
while ifs= read -r i; #reading file line line , saving lines in $i. grep "$i" file2 >> output #grepping line in second file , outputting. done < file1
your question needs edited give more details though.
Comments
Post a Comment