Re: Word Count for a specific set of files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list




-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux