unix - Using inverse grep to compare two .txt files -
I have two .txt files "test1.txt" and "test2.txt" and I inverse grep (UNIX) Test2 To find all the lines in .txt which do not include any row in test1.txt
test1.txt contains only usernames, whereas test2.txt contains long strings of text I only I want a line in test2.txt that does not include the username found in test1.txt
Will such a thing happen?
grep -v test1.txt test2 .txt & gt; You should have at least one option (i.e. - f) your solution -f flag, look like sample session demo session
$ # First file $ cat a.txt xxxx yyyy Kkkkkk zzzzzzzz $ # Other file $ cat b.txt does not have any name in the line This person is xxxx yyyy good is another line in which there is no name kkkkkk is a good name ? This name is asleep ... zzzzzzzz I can not find any other name, try the command now $ # -i is used only to ignore the case while searching for $ $, from the second file only There are rows in which there is no text for the first file lines $ Grep -v -i -f a.txt b.txt does not have any name in the line, no other line in which there is no name. I can not find any other name Now try the command
Comments
Post a Comment