mooshak@[EMAIL PROTECTED]
wrote:
> Hi All,
>
> My apologies if this has been covered in the past.
>
> I am trying to parse lines in a file. I would like to catpure
> anything after $8 as one variable. For example, in the line below, I
> would like "insert into schema.tab values" to be $8. By default, awk
> parses the word 'insert' as $8.
>
> Is there an easy way to do it?
>
>
> 0x078000007E1B3840 14 41382 1 1 2
> 2 insert into schema.tab values
What's in between the first 7 numbers; is that TAB, or a fixed number
of white space characters, or an arbitrary sequence of white space
characters?
To start at fixed column number use substr($0,start_index), otherwise
use match(); in the first (the TAB) case it might be
awk 'sub(/.*\t/,"")||1'
otherwise the pattern is more lengthy, something like
awk 'BEGIN{b="[[:blank:]]+";n="[^[:blank:]]+"}
sub(n b n b n b n b n b n b n b,"")||1'
If you don't care about white space preservation in the remaining string
you may also use the method to assign empty strings to the first fields
{$1=$2=$3=$4=$5=$6=$7=""; print substr($0,8)}
Janis
>
>
> Thanks
>
> Moosh


|