Word Count for a specific set of files
Nabin Limbu
nlimbu at healthnet.org.np
Fri Jun 18 14:00:53 UTC 2004
Hi James H. Cutts,
Hope this will help you
#!/bin/bash
j=1
for i in `ls -1rS`
do
if [ $j -gt 10 ]; then exit; fi
j=`expr $j + 1`
echo `wc -w $i`
done
With Regards
Nabin Limbu
James H. Cutts III said:
> I need some shell scripting assistance. I want a word count of the
> smallest 10 files in a directory.
>
> I can get the list of the smallest 10 files: ls -1S | tail
>
> I can get the count of a list of files: wc <fn1> <fn2> ... <fn10>
>
> How can I put these two commands together to get wc to use the list of
> files I get back from the ls / tail command.
>
> Thanks,
> James H. Cutts III
> Computer Project Manager
> SOM-RES / CORI
> University of Missouri - Columbia
>
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
More information about the redhat-list
mailing list