Saint Nick
Lifer
Given a sample of my log file that is constantly written to:
I want to return the panel ID (TIMX270, TIMD081, etc.). I've made it this far.11/07/2011 12:09:20.115783, x5994, End PG01 (panel TIMG093) Txntime 0.411531 sec, pid 2864241
11/07/2011 12:09:20.596116, x5994, Begin PG01, pid 2295144
11/07/2011 12:09:20.750298, x11kxk, Begin PG01, pid 2213044
11/07/2011 12:09:20.830860, x4026, Begin PM01, pid 681707
11/07/2011 12:09:21.050209, x11kxk, End PG01 (panel TIMG020) Txntime 0.299911 sec, pid 2213044
11/07/2011 12:09:21.291839, x10913, Begin PD20, pid 558718
11/07/2011 12:09:21.354671, x4026, End PM01 (panel TIMM010) Txntime 0.523811 sec, pid 681707
11/07/2011 12:09:21.613560, x10913, End PD20 (panel TIMD20G) Txntime 0.321721 sec, pid 558718
11/07/2011 12:09:21.661077, x11epi, Begin PD08, pid 599314
11/07/2011 12:09:21.871423, x5994, End PG01 (panel TIMG093) Txntime 1.275307 sec, pid 2295144
11/07/2011 12:09:21.923036, x4797, Begin PX27, pid 2327543
11/07/2011 12:09:22.091868, x4835, Begin PASS, pid 625412
11/07/2011 12:09:22.198136, x11epi, End PD08 (panel TIMD081) Txntime 0.537059 sec, pid 599314
11/07/2011 12:09:22.379719, x5994, Begin PG01, pid 710105
11/07/2011 12:09:22.526667, x4797, End PX27 (panel TIMX270) Txntime 0.603631 sec, pid 2327543
11/07/2011 12:09:22.964977, x5994, End PG01 (panel TIMG093) Txntime 0.585258 sec, pid 710105
11/07/2011 12:09:23.426903, x10913, Begin PD20, pid 494923
11/07/2011 12:09:23.884180, x4026, Begin PM01, pid 542721
11/07/2011 12:09:23.888926, x11epi, Begin PD08, pid 740103
11/07/2011 12:09:23.935553, x4835, End PASS (panel ) Txntime 1.843685 sec, pid 625412
But, this will only make the output like this.tail -f $infile | sed -n '/TIM[A-Z][0-9][0-9][0-9]/p'
My desired output is:11/07/2011 11:56:47.652304, x6278, End PM10 (panel TIMM100) Txntime 0.681214 sec, pid 1739722
11/07/2011 11:56:47.753127, x8172, End PD03 (panel TIMD030) Txntime 0.372174 sec, pid 1798617
11/07/2011 11:56:47.975405, x8172, End PX00 (panel TIMX000) Txntime 0.198091 sec, pid 1588831
11/07/2011 11:56:48.655058, x6188, End PM10 (panel TIMM100) Txntime 0.804459 sec, pid 2006503
11/07/2011 11:56:50.978475, x5641, End PN33 (panel TIMN331) Txntime 0.470516 sec, pid 1459044
11/07/2011 11:56:51.500535, x7600, End PM10 (panel TIMM102) Txntime 0.451346 sec, pid 1564634
11/07/2011 11:56:51.609356, x11kxk, End PG01 (panel TIMG020) Txntime 0.394369 sec, pid 1782118
11/07/2011 11:56:51.888329, x4797, End PD08 (panel TIMD081) Txntime 1.062310 sec, pid 1568333
I tried piping the command out to a cut command, but it didn't work (the panel ID is in the same character location). I would prefer to do this within awk/sed/perl so that it can remain robust. In the future we will be doing this for IP addresses.TIMM102
TIMG020
TIMD081
...