1847136 Members
6167 Online
110263 Solutions
New Discussion

Re: record length

 
SOLVED
Go to solution
gary phipps
Frequent Advisor

record length

Hi all,

nice simple one for you...how do you display the record lengths for an ascii text file?


thanks in advance,

Gary.
4 REPLIES 4
Chris Wilshaw
Honored Contributor
Solution

Re: record length

If by record length, you mean line length

cat | awk '{print length}'
Jean-Luc Oudart
Honored Contributor

Re: record length

For the record size of a file (for each line) :
awk '{print length ; }'

Jean-Luc
fiat lux
gary phipps
Frequent Advisor

Re: record length

Excellent.

Thanks for the quick response guys
Stefan Farrelly
Honored Contributor

Re: record length


Lets use the password file as an example, to see the length of each line;

cat /etc/passwd|while true
do
read A
echo $A|wc -c # display line/record length
[ "$A" = "" ] && exit
done
Im from Palmerston North, New Zealand, but somehow ended up in London...