Saturday 16 May 2009

remedy for argument list too long when couting lines

While counting no.of lines in large files of large number (say 3000 files), zcat $.txt | wc -l says argument list tool long,the other way to do this is :

sum=0;for file in `echo pg_*` ;do s=$(zcat $file | wc -l);sum=`expr $sum + $s`; done ; echo $sum

No comments:

Post a Comment

Tweets by @sriramperumalla