Count The Number of Characters In a Field With awk

A quick one-liner for counting the number of characters in a given field for each line in an ASCII file.

for i in `cat source.txt`; do echo $i | awk¬† {‘print length($1)}’ >> counts.txt

Leave a Reply