Need pattern Extract

2014-05-31-18.22.18.500158-240 E11115478A502      LEVEL: Info
PID     : 25100668             TID  : 73282       PROC : db2sysc 0
INSTANCE: udbin001             NODE : 000         DB   : 
APPHDL  : 0-18345              APPID: *LOCAL.udbin001.140531200018
AUTHID  : udbin001
EDUID   : 73282                EDUNAME: db2agent (IBGPM01P) 0
FUNCTION: DB2 UDB, database utilities, sqluxLogDataStats, probe:312
MESSAGE : Actual size of backup in bytes:
DATA #1 : unsigned integer, 8 bytes
175023153152

2014-06-01-11.58.08.193212-240 E11131215A503      LEVEL: Info
PID     : 25100668             TID  : 66744       PROC : db2sysc 0
INSTANCE: udbin001             NODE : 000         DB   : 
APPHDL  : 0-13715              APPID: *LOCAL.udbin001.140601130013
AUTHID  : udbin001
EDUID   : 66744                EDUNAME: db2agent (IBGPM01P) 0
FUNCTION: DB2 UDB, database utilities, sqluxLogDataStats, probe:312
MESSAGE : Actual size of backup in bytes:
DATA #1 : unsigned integer, 8 bytes
3378060292096

2014-06-02-18.21.43.195977-240 E11542845A501      LEVEL: Info
PID     : 25100668             TID  : 74822       PROC : db2sysc 0
INSTANCE: udbin001             NODE : 000         DB   : 
APPHDL  : 0-41425              APPID: *LOCAL.udbin001.140602200006
AUTHID  : udbin001
EDUID   : 74822                EDUNAME: db2agent (IBGPM01P) 0
FUNCTION: DB2 UDB, database utilities, sqluxLogDataStats, probe:312
MESSAGE : Actual size of backup in bytes:
DATA #1 : unsigned integer, 8 bytes
40982392832

I wish to extract the following details from above file content
time

2014-05-31-18.22,175023153152
2014-06-01-11.58,3378060292096
2014-06-02-18.21,40982392832

I use cat <filename> | grep -ip -w "Actual size of backup in bytes:" to extract the above details from a main diaglog. However i would need the above details . I'm ok with any solution based on awk, sed.

awk '{printf("%s.%s,%s\n", $1,$2,$NF)}' FS="." RS="" file
1 Like

Ohh my god !!! it works perfectly what i was looking for. Thank you so so so much. Lovely.

---------- Post updated at 04:04 PM ---------- Previous update was at 03:54 PM ----------

Don't mind if am asking one more help.
is it possible to get one more o/p like this

2014-06-05-18.25.50.122294-240 E12133254A502      LEVEL: Info
PID     : 25100668             TID  : 48159       PROC : db2sysc 0
INSTANCE: udbsjfx1             NODE : 000         DB   : DBNPM01P
APPHDL  : 0-18561              APPID: *LOCAL.udbpa166.140605200020
AUTHID  : UDBPA166
EDUID   : 48159                EDUNAME: db2agent (IBGPM01P) 0
FUNCTION: DB2 UDB, database utilities, sqluxLogDataStats, probe:312
MESSAGE : Actual size of backup in bytes:
DATA #1 : unsigned integer, 8 bytes
207743524864

I want to extract like this

2014-06-05-18.25, udbsjfx1, DBNPM01P, 207743524864
awk '{printf("%16.16s, %s, %s, %s\n", $1,$16,$22,$NF)}' RS="" file

See my response in the other thread:

1 Like