LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-12-2007, 09:28 AM   #1
sancho1980
Member
 
Registered: May 2006
Location: Leipzig, Germany
Distribution: Kanotix 64
Posts: 45

Rep: Reputation: 15
compare linecount of two files


hi

i know that

wc -l file

gives me the line count of a file.

can someone please tell me how i can compare the number of two files in a script and then perform some action if the difference between the 2 is above some predefined number?


Thanks

Martin
 
Old 10-12-2007, 09:48 AM   #2
Samotnik
Member
 
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471

Rep: Reputation: 40
if $(($(wc -l file1)-$(wc -l file2)))>=$DEF; than <action>; fi
 
Old 10-12-2007, 09:51 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,833

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
gotta watch them than's - never know where they'll pop up ...
 
Old 10-12-2007, 10:37 AM   #4
sancho1980
Member
 
Registered: May 2006
Location: Leipzig, Germany
Distribution: Kanotix 64
Posts: 45

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Samotnik View Post
if $(($(wc -l file1)-$(wc -l file2)))>=$DEF; than <action>; fi
the logic is quite clear to me
but not the syntax
and this solution gives me errors :-(
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare files in specific directory to files on CD szim90 Linux - Newbie 3 02-10-2007 09:39 PM
Compare two files namit Linux - Software 1 12-31-2005 09:10 AM
How do I compare 2 files? linuxhippy Slackware 6 03-26-2005 02:54 AM
Diff compare 2 files DavidTempler Linux - Newbie 2 11-01-2004 11:00 AM
Compare two cvs files.... trey85stang Linux - General 3 10-23-2004 09:05 PM


All times are GMT -5. The time now is 10:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration