[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


HTH,
 -Remco


Reply to: