> quite easily with $1 $2 $3 etc, but how can I get awk to print out the rest 
> of the line after field $3 and ignore any delimiter characters in the free 

> 01/10/2003 01:02:03 MyCommand: Here is some free form text from command

> $1 = date (01/10/2003)
> $2 = time (01:02:03)
> $3 = command (MyCommand:)
> ?? = Here is some free form text from command

If it has to be awk, you can't. You'll have to find out how many
characters are used by the first 3 columns (which are white-space
delimited), add one (for the 4th white space, and hope it's only 1
blank), then use substr() to get the remainder of $0 from there on. You
also hope command doesn't contain a space.
Alternatively, you could use index() to find the position of the third
colon, add one, use substr().

If it doesn't have to be awk, bash will do it nicely:

while read -r date time command freeformtext; do
   echo $date $time $command $freeformtext
done < logfile

Similar resitrctions to white space to awk apply here.

Volker

-- 
Volker Kuhlmann                 is possibly list0570 with the domain in header
http://volker.dnsalias.net/             Please do not CC list postings to me.

Reply via email to