![]() |
linux guru help, command diff
Is there anyone in here who has experience with the command "diff" in linux,
I have a list with names "names.txt" and i have a list with names that should be removed from "names.txt" and it should generate an output of names.txt with the names from the remove list removed. :helpme :helpme :helpme |
anyone ???
|
Code:
cat names.txt removes.txt|sort|uniq -u > newneatnames.txt |
Quote:
|
man sort
|
diff -c <filename> <filename.orig> > whatever.txt
|
Quote:
|
Quote:
you want to use comm, not diff. comm -3 names.txt remove.txt > clean.txt Usage: comm [OPTION]... FILE1 FILE2 Compare sorted files FILE1 and FILE2 line by line. With no options, produce three-column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column three contains lines common to both files. -1 suppress lines unique to FILE1 -2 suppress lines unique to FILE2 -3 suppress lines that appear in both files |
Quote:
Code:
gw00# cat test.txt |
I was wrong. Didn't know the -u option, but the comm command seemed perfect for this. Congrats, you've been a real prick about it. Always good to know who the assholes are.
|
Both lists will need to be sorted when i use the comm command, right ?
|
All times are GMT -7. The time now is 06:20 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123