I am trying to use awk to print lines that contain the string DOWN until a new entry (date) is found on the following line. Ex. I would like to print lines 1-3 below only because line one has the string DOWN and the entry continues until line 3. Line 4 is a new entry that does not contain the string DOWN, so I would skip that entry.
10/01/2003 03:55:18 gsc-fin gsc-fin media id 501171 is in a DOWN drive,
misplaced, write protected or unmountable; attempting
retry with a different media id
10/01/2003 04:35:17 gsc-fin prog-mgt from client prog-mgt: WRN - Could not
reset access time of /raid310/opt/ent/seos/log/seos.audit
Below is the awk script that I have started and it's output.
/DOWN/{if (NF>=8) tape = $7; printf("Please verify the status of volume %d.\n\n", tape) ; print $0}
Output:
Please verify the status of volume 501171.
10/01/2003 03:55:18 gsc-fin gsc-fin media id 501171 is in a DOWN drive,
Desired Output:
Please verify the status of volume 501171.
10/01/2003 03:55:18 gsc-fin gsc-fin media id 501171 is in a DOWN drive, misplaced, write protected or unmountable; attempting retry with a different media id
Any help would be greatly appreciated.
Thanks,
John
10/01/2003 03:55:18 gsc-fin gsc-fin media id 501171 is in a DOWN drive,
misplaced, write protected or unmountable; attempting
retry with a different media id
10/01/2003 04:35:17 gsc-fin prog-mgt from client prog-mgt: WRN - Could not
reset access time of /raid310/opt/ent/seos/log/seos.audit
Below is the awk script that I have started and it's output.
/DOWN/{if (NF>=8) tape = $7; printf("Please verify the status of volume %d.\n\n", tape) ; print $0}
Output:
Please verify the status of volume 501171.
10/01/2003 03:55:18 gsc-fin gsc-fin media id 501171 is in a DOWN drive,
Desired Output:
Please verify the status of volume 501171.
10/01/2003 03:55:18 gsc-fin gsc-fin media id 501171 is in a DOWN drive, misplaced, write protected or unmountable; attempting retry with a different media id
Any help would be greatly appreciated.
Thanks,
John