ggrep is my new BFF

Picked up a handy log file search tip today, for searching those pesky log file formats that list date on one line, then the log message on the next line (alert logs, for instance).  It’s annoying to grep for just what you want to see, then not have any idea what the timestamp was.  I’ve seen it done with some sed or awk, but this is the simplest yet:

$ ggrep -B 1 "advanced" alert_SID.log
Fri Oct 15 09:50:06 2010
Thread 1 advanced to log sequence 2805 (LGWR switch)
--
Fri Oct 15 09:50:06 2010
Thread 1 advanced to log sequence 2806 (LGWR switch)
--
Fri Oct 15 09:50:09 2010
Thread 1 advanced to log sequence 2807 (LGWR switch)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s