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

Re: Counting number of lines in a text file



Jay Barbee wrote:
> >> I was wondering what the quickest way to count the number of records
> >> (lines) in a text file.  It would be neat to do many files at once and
> >> save the output in a seperate file in the format 'filename:::#records'.
> >
> >for a in file1 file2 file3; do \
> >  echo -n $a >> seperate_file; \
> >  echo -n ":::" >> seperate_file; \
> >  wc -l $a >> seperate_file; \
> >done
> 
> How would I gather a list of all TXT files in the directory before this
> and pass each file to this script.

Change the 'file1 file2 file3' list to '*.txt' for example...


 -Remco


Reply to: