Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 09-16-2005, 03:12 AM   #1
etech
Confirmed User
 
Join Date: Feb 2004
Location: Right next to you....
Posts: 1,148
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.
etech is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-16-2005, 03:24 AM   #2
etech
Confirmed User
 
Join Date: Feb 2004
Location: Right next to you....
Posts: 1,148
anyone ???
etech is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-16-2005, 03:32 AM   #3
darksoul
Confirmed User
 
darksoul's Avatar
 
Join Date: Apr 2002
Location: /root/
Posts: 4,997
Code:
cat names.txt removes.txt|sort|uniq -u > newneatnames.txt
__________________
1337 5y54|)m1n: 157717888
BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
Cambooth
darksoul is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-16-2005, 04:10 AM   #4
etech
Confirmed User
 
Join Date: Feb 2004
Location: Right next to you....
Posts: 1,148
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.
etech is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-16-2005, 04:13 AM   #5
Superterrorizer
Confirmed User
 
Join Date: Sep 2003
Posts: 509
man sort
Superterrorizer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-16-2005, 04:21 AM   #6
JaveWolf
Registered User
 
Join Date: Jun 2003
Posts: 89
diff -c <filename> <filename.orig> > whatever.txt
__________________
Don't look here
JaveWolf is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-16-2005, 06:27 AM   #7
darksoul
Confirmed User
 
darksoul's Avatar
 
Join Date: Apr 2002
Location: /root/
Posts: 4,997
Quote:
Originally Posted by etech
Well this will still leave the second duplicate in the list.
no it won't.
__________________
1337 5y54|)m1n: 157717888
BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
Cambooth
darksoul is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-16-2005, 08:47 AM   #8
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
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
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-16-2005, 09:01 AM   #9
darksoul
Confirmed User
 
darksoul's Avatar
 
Join Date: Apr 2002
Location: /root/
Posts: 4,997
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
__________________
1337 5y54|)m1n: 157717888
BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
Cambooth
darksoul is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-16-2005, 09:58 AM   #10
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
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.
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-16-2005, 10:13 AM   #11
etech
Confirmed User
 
Join Date: Feb 2004
Location: Right next to you....
Posts: 1,148
Both lists will need to be sorted when i use the comm command, right ?
etech is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.