HP3000-L Archives

May 1997, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ross Scroggs <[log in to unmask]>
Reply To:
Ross Scroggs <[log in to unmask]>
Date:
Sat, 10 May 1997 12:24:36 PDT
Content-Type:
text/plain
Parts/Attachments:
text/plain (32 lines)
> wc -l /DEV/SOURCE/* | tail -1
> wc: cannot execute: Arg list too long
>
> The following variation might utilize the available
> command line buffer more effectively but will, of course,
> also fail at a certain amount of files per directory...
>
> shell/iX> cd /DEV/SOURCE ; wc -l * | tail -1
>
> Regards, Lars.
>
The command line isn't infinite, so loops are used to scan over the file set.

#!/bin/sh
NumFiles=0
NumLines=0
for File in *
do
  NumFiles=`expr $NumFiles + 1`
  Lines=`wc -l $File | awk '{ print $1 }'`
  NumLines=`expr $NumLines + $Lines`
done
echo "Files: $NumFiles, Lines: $NumLines"

--
--------------------------------------------------------------------
Ross Scroggs                         email: [log in to unmask]
Telamon, Inc.                          CIS: 76011,2234
492 Ninth Street, Suite 310          voice: 510-987-7700
Oakland, CA 94607-4098                 fax: 510-987-7009
--------------------------------------------------------------------

ATOM RSS1 RSS2