On Tue, 07 Oct 2003 17:49, you wrote:
> I'm trying to parse a log file, very similar to /var/log/messages, where
> there are some quite well defined fields at the start of the line, but then
> some free form text at the end. I can extract and process the first few
> fields 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 from text?
>
> For example, consider the input
>
> 01/10/2003 01:02:03 MyCommand: Here is some free form text from command
>
> When parsed with awk:
>
> $1 = date (01/10/2003)
> $2 = time (01:02:03)
> $3 = command (MyCommand:)
> ?? = Here is some free form text from command

for All Things Awk see:-
http://cm.bell-labs.com/cm/cs/awkbook/
Which include the source code for the "One True Awk" and, for those folks who 
want the info Free:-
http://www.gnu.org/manual/gawk/index.html

-- 
Sincerely etc.,
Christopher Sawtell

Reply via email to