command line log file parsing

E

Euan

Hi,
Please advise best cmd line method to parse a log file to return lines that meet certain criteria. For example:
Input (log file)
2004.01.26 11:21:20.461 874 /servlet/user
2004.01.26 11:23:30.211 64 /servlet/user2
Perl command
(print top STDOUT all lines where the third column > 500)
Output
2004.01.26 11:21:20.461 874 /servlet/user

Thanks.......
 
A

Anno Siegel

Euan said:
Hi,
Please advise best cmd line method to parse a log file to return lines
that meet certain criteria. For example:
Input (log file)
2004.01.26 11:21:20.461 874 /servlet/user
2004.01.26 11:23:30.211 64 /servlet/user2
Perl command
(print top STDOUT all lines where the third column > 500)
Output

Check out the -a switch to perl (perldoc perlrun) and the @F array
(perldoc perlvar).

Anno
 
J

John W. Krahn

Euan said:
Please advise best cmd line method to parse a log file to return lines
that meet certain criteria. For example:
Input (log file)
2004.01.26 11:21:20.461 874 /servlet/user
2004.01.26 11:23:30.211 64 /servlet/user2
Perl command
(print top STDOUT all lines where the third column > 500)
Output

perl -nae'print if $F[2] > 500' log_file


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,145
Messages
2,570,825
Members
47,371
Latest member
Brkaa

Latest Threads

Top