Awk Problem

when i try to read records with more than 6000 charecters in a line.. the record says..
Record 'xxx xxxx' TOO LONG

what can be the work around??

if under Solaris, use 'nawk' or '/usr/xpg4/bin/awk' or gawk [if you have one].

this problem occured only when trying to use awk... is there anyother alternative???

have you tried any of the alternatives posted previously?

yes i hav tried all alternatives.. but does not work.. what can b done?

According to Posix, the various utilities must work with lines up to LINE_MAX in length and LINE_MAX must de defined in limits.h (usually in /usr/include). When your lines are too long, lots of programs won't work. LINE_MAX is often 2048.

That reminds me: several days ago developers came and asked me if i could raise the 2k char line limitation for Korn shell command lines.

I'd like to repeat here what i told them: Command lines that long are invariably faulty and my job as a systems administrator is not to make arbitrarily bad designs possible.

You could:

  • use sed to break the lines into smaller ones;

  • redesign the process which creates that long lines to create shorter ones;

  • rethink the whole process which makes you end up with lines that long and set up a better one.

Perhaps the last thing would be the "right thing to do" and - borrowing from Richard Gabriels article "Worse is Better" - the "MIT-approach" to solve your problem.

bakunin

Perhaps try converting your awk program to perl using a2p