Re: scripting question

From: Holger.VanKoll@SWISSCOM.COM
Date: Thu May 22 2003 - 10:15:06 EDT


cat your_file|wc -l|read lines; [ $lines -eq $your_desired_number ] &&
exit 0 || exit 1

your problem in using wc is maybe that it returns leading spaces. thats
why I use read ; not lines=`cat your_file|wc -l`

-----Original Message-----
From: John Dunn [mailto:john.dunn@SEFAS.CO.UK]
Sent: Thursday, May 22, 2003 3:57 PM
To: aix-l@Princeton.EDU
Subject: scripting question

Is it possible to write a one line command that will test whether a file
contains a specific number of lines, returning 0 if it dies, 1 if it
doesn't

I've been playing around with wc and test with no luck.

John



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:51 EDT