#1 02 Aug 2007 06:21

vishalbarde
Member
Registered: 02 Aug 2007
Posts: 1

Printing in awk

Hi,

i am new to the awk command.


awk '{if(length < 104)}' table_name
echo "LENGTH ERROR: Record U length is not correct; expected 104 received:" length of table_name

i am trying to solve this. In the echo part i need the length of the table, but its not coming. Instead its coming as given below.

echo "LENGTH ERROR: Record U length is not correct; expected 104 received:" length of table_name



Please help me out ASAP.

Offline

#2 04 Aug 2007 11:06

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 1,011
Website

Re: Printing in awk

Im not sure what you mean by length of table

to get the length of each line try this

awk '{ print length($0) }' table_name.txt

Offline

Board footer

Powered by FluxBB