in reply to Extracting data from each line that matches a email address from a Log file (Tab delimited)

awk -F"\t" '/Auser/ { print $1, $2, $8, $20 }' file.txt
see 'perldoc a2p' to perlify this (update: echo "/Auser/ { print $1, $2, $8, $20 }" | a2p -F"<tab-character-here>" to generate a perl script). Or UnxUtils if you just want to use (g)awk on Windows (and use all double quotes above if Windows).
  • Comment on Re: Extracting data from each line that matches a email address from a Log file (Tab delimited)
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Extracting data from each line that matches a email address from a Log file (Tab delimited)
by Moriarty (Abbot) on Oct 11, 2005 at 00:53 UTC

    Wouldn't it have been better to just show the op the Perl version?

    I believe it comes out something like this :-

    while (<>) { my @Fld = split('\t', $_); if (/Auser/) { print $Fld[0], $Fld[1], $Fld[7], $Fld[19]; } }