The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
diff command ariec AIX 3 06-05-2008 03:16 AM
diff command Vichu Shell Programming and Scripting 1 04-28-2008 07:06 AM
Need help with Scripting diff command tlfletcher05 Shell Programming and Scripting 2 01-26-2008 02:19 AM
Diff command problem gvsreddy_539 Shell Programming and Scripting 4 09-30-2007 08:36 AM
diff command gilead29 UNIX for Dummies Questions & Answers 7 03-09-2004 09:12 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-26-2008
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
need help in diff command :

i have 2 file named test1,test2
contents of test1:

1
2
3
---------------------------
contents of test2:
1
2
3
4
5
--------------------------------------------------------

my desired o/p should be:

diff test2 test1

4
5

this is just an example/.like wise i have so many umached line with test1.Actually test2 will contain all the data of test1 and sometimes some extra data,so i want to grep those extra data or lines in test2.

plz help me in this
  #2 (permalink)  
Old 05-26-2008
siba.s.nayak siba.s.nayak is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 164
Hi,

Diff command checks bit bit. If order of existance if matters then first sort two files then use diff command. It will give you your desired output.

Regards,
Siba
  #3 (permalink)  
Old 05-26-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,420
grep can do the job.
Code:
grep -vf test1 test2
  #4 (permalink)  
Old 05-26-2008
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
the command

grep -vf is working only for small files. i have file some 10gb.here actually i m comparing 2 10gb files.

its showing error as :

invalid range expression
  #5 (permalink)  
Old 05-26-2008
frajer frajer is offline
Registered User
  
 

Join Date: Sep 2005
Location: Slovenija
Posts: 20
Code:
</> cat file1 file2 | sort | uniq -u
...but I'm not sure for big files. Don't have 2GB one right nov
  #6 (permalink)  
Old 05-26-2008
Tornado's Avatar
Tornado Tornado is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Melbourne
Posts: 249
You can use the comm command.
Code:
# cat test1
1
2
3
# cat test2
1
2
3
4
5
# comm -13 test1 test2
4
5
#

Last edited by Tornado; 05-27-2008 at 07:17 PM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:41 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0