awk to find the length of each record.

Hi Guys,

I wanted to print the length of each record and the record itself.
I tried the following awk ...

awk 'a=length(); {print $a,$0}' file1

But it is giving me the records instead of length.
and also, it giving me each record twice. Means the value of a is not the length of the record but the record itself..

could you please point out my mistake..

thanks
Magesh

---------- Post updated at 06:52 PM ---------- Previous update was at 06:46 PM ----------

Guys, i found the answer..

awk '{print  length($0),$0}' file1