GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   linux guru help, command diff (https://gfy.com/showthread.php?t=517196)

etech 09-16-2005 03:12 AM

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

etech 09-16-2005 03:24 AM

anyone ???

darksoul 09-16-2005 03:32 AM

Code:

cat names.txt removes.txt|sort|uniq -u > newneatnames.txt

etech 09-16-2005 04:10 AM

Quote:

Originally Posted by darksoul
Code:

cat names.txt removes.txt|sort|uniq -u > newneatnames.txt

Well this will still leave the second duplicate in the list.

Superterrorizer 09-16-2005 04:13 AM

man sort

JaveWolf 09-16-2005 04:21 AM

diff -c <filename> <filename.orig> > whatever.txt

darksoul 09-16-2005 06:27 AM

Quote:

Originally Posted by etech
Well this will still leave the second duplicate in the list.

no it won't.

Brujah 09-16-2005 08:47 AM

Quote:

Originally Posted by darksoul
no it won't.

lol, yes it will.


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

darksoul 09-16-2005 09:01 AM

Quote:

Originally Posted by Brujah
lol, yes it will.

lol. no it won't. God I hate ignorant people.

Code:

gw00# cat test.txt
gofuckyourself.com
brujah is a wannabe
gw00# cat test2.txt
gofuckyourself.com
gw00# cat test.txt test2.txt|sort|uniq -u
brujah is a wannabe

:321GFY

Brujah 09-16-2005 09:58 AM

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.

etech 09-16-2005 10:13 AM

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