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
Formatting the output from diff ragavhere Shell Programming and Scripting 9 05-07-2008 04:40 AM
Diff output, unwanted characters scanner248 UNIX for Dummies Questions & Answers 5 10-17-2007 04:23 PM
parsing output from a diff command... kam Shell Programming and Scripting 5 05-29-2007 11:26 PM
diff output paulp UNIX for Dummies Questions & Answers 3 04-14-2005 02:27 AM
diff 2 files; output diff's to 3rd file blt123 Shell Programming and Scripting 2 05-28-2002 11:29 AM

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 06-08-2007
bobk544 bobk544 is offline
Registered User
  
 

Join Date: Jan 2006
Location: fairfax virginia
Posts: 58
Is there a way to limit DIFF output

Hello is there a way to limit the number of lines output by the DIFF command?

I tried -C 200 ect and -c but it continues to print out the whole huge file.

Reason needed is i'm trying to do alot of DIFFs on a long list of files and would like to only get back an indicator which files are different, ie using $? following the DIFF or something like that

Thanks!
BobK
  #2 (permalink)  
Old 06-08-2007
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,418
Use the -q option of diff.

Code:
$ diff infile infile2
5c5
< abc|def|123|456|
---
> ____abc|def|123|456|
$ echo $?
1
$ diff -q infile infile2
Files infile and infile2 differ
$ echo $?
1
$
you can also use the cmp command :
Code:
$ cmp infile infile2
infile infile2 differ: char 32, line 5
$ echo $?
1
$ cmp -s infile infile2
$ echo $?
1
$
Jean-Pierre.
  #3 (permalink)  
Old 06-08-2007
bobk544 bobk544 is offline
Registered User
  
 

Join Date: Jan 2006
Location: fairfax virginia
Posts: 58
great thanks alot works great! have a nice weekend!
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 05:45 PM.


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