Hi,
I wasn't quite sure how to title this one! Here goes:
I have some already partially parsed log files, which I now need to extract info from. Because of the way they are originally and the fact they have been partially processed already, I can't make any assumptions on the number of fields and the exact format etc. All I know is I can look for certain patterns. An extract of the original source is:
Job <1>, Job Name <BLAH>, Queue-- MEMLIMIT 10 G Fri Oct 11 09:55:48: Started on <cn035>, -- The CPU time is 12 seconds. MEM: 1 Gbytes;
Job <2>, Job Name <BLAH>, Queue-- MEMLIMIT 10 G Fri Oct 11 09:55:48: Started on <cn069>, -- The CPU time is 10 seconds. MEM: 1 Gbytes;
Job <3>, Job Name <BLAH>, MEMLIMIT 10 G Fri Oct 11 09:55:48: Started on <cn049>, ;-- The CPU time is 13 seconds. MEM: 2 Gbytes;
Job <4>, Job Name <BLAH>, Status <RUN>, Command <-- The CPU time is 76 seconds. MEM: 3 Gbytes;
Job <7>, Job Name <BLAH>, Stat us <RUN>, Command <-- The CPU time is 49 seconds. MEM: 1014 Mbytes;
Job <8>, Job Name <BLAH> , Status <RUN>, -- MEMLIMIT 10 G Fri Oct 11 22:13:19: Started on <cn014>;-- The CPU time is 12 seconds. MEM: 391 Mbytes;
Job <9>, Job Name <BLAH>, Status <RUN >, Command <: Started on <cn026>,-- The CPU time is 71 seconds. MEM: 13 Mbytes;
Job <10>, Job Name <BLAH>, Sta tus <RUN>, Command <#!/bi-- MEMLIMIT 22 G Started on <cn064>, -- The CPU time is 25 seconds. MEM: 12 Gbytes;
I want to extract based on:
Started on <____>,
MEMLIMIT __ G
MEM: ___ bytes;
The first line example being:
MEMLIMIT 10 G Fri Oct 11 09:55:48: Started on <cn035>, -- The CPU time is 12 seconds. MEM: 1 Gbytes;
Each line may contain all, some or none of the above. My ideal output based on the above would be something like:
Started: cn035 MEMLIMIT: 10 G MEM: 1 G
Started: cn069 MEMLIMIT: 10 G MEM: 1 G
etc
etc
(ideally, if there is no MEMLIMIT found on a line for example):
Started: cn026 MEMLIMIT: 0 G MEM: 13 M
I've messed around with gsub in awk to extract a single instance but couldn't work out how to select on multiple patterns...
Any help as always would be appreciated!