On Wed, Oct 08, 2003 at 12:36:14PM +1300, Peter Glassenbury wrote:
> What about using $0 (whole line) and
> length($1),length($2),length($3) and substr($0,sumoflengths)
> or something like that ?
It won't work. You need to take into account not only the length of the
already used fields, but also the field separators between the fields.
This should do the trick:
#! /usr/bin/awk -f
{
printf("1: \"%s\" 2: \"%s\" 3: \"%s\"\n", $1, $2, $3);
rest = index($0, $4);
printf("rest: \"%s\"\n", substr($0, rest));
}
Cheers,
-mjg
--
Matthew Gregan |/
/| [EMAIL PROTECTED]