NathanFriend.co.uk

Developers notebook

Month: May 2009

Speed test

CAT and GREP

When you want to see specific lines across two or more files, pipe CAT to GREP.

cat *.log | grep ‘specific string’

This will CAT (concatenate) all .log files in current directory and pipe the output to GREP (get regular expression) which will single out the lines that match ‘specific string’ and output to your terminal.  Alternatively to output to a result file:

cat *.log | grep -o ‘specific string’ >result

© 2017 NathanFriend.co.uk

Theme by Anders NorenUp ↑