I have two files and I would like to display the duplicate line I tried to do it but it does not work:
I am thinking that there is no other way to display duplicate lines in the file. I have a list of IDs in both files. files sorted? Can they be sorted? If sorted: If you do not have You can type grep -F : It appears in the words of cat id1.txt | While reading the ID; Grep "$ id" id2.txt; Done
comm-12 id1.txt id2.txt
bash 4.x:
comm-12 & lt; (Sort id 1.txt) & lt; (Sort id 2.txt)
bash 4.x and can not be resolved using temporary files.
grep -F -f id1.txt id2.txt
id1.txt which appears in
id2.txt . Only one problem here is making sure that no ID
1 matches any ID containing
1 anywhere. Available in some versions the
-w or
-x options will work here.
No comments:
Post a Comment