Hi i am a noob and need a little help to finish my shell script. I am learning as i go but hit a problem.
I am search thorugh logs(*.rv) files to find entires between two user defined dates,ie dd mm yyyy - dd mm yyy
The script so far looks for the "START" and "END" of each entry at sees if it belongs To an ORGID number. then only take the whole record based on OGID and in the a date range given
gawk '/^START/ { ok=0; sec="" } /^START/,/^END/ { sec=sec "\n" $0 }$2==281688 { ok=1 }/^END/ && ok { print sec }' *.rv>BUSORG_ORGID${BUSORG_ORGID}st${START_DAY}${START_MONTH}end${END_DAY}${END_MONTH}.txt
extract of one *.rv file
START: Mon Apr 24 10:09:19 2006:
Mon Apr 24 10:09:19 2006: service: before tpcall(), buffer being sent...
G_FLAG 0
CLFY_SUB slicker
MESSAGE_ID fooo bar foo
BUSORG_ORGID 281688
service: now I'm sending that...
Mon Apr 24 10:09:19 2006: Mon Apr 24 10:09:20 2006: service: after tpcall(), buffer received...
E_NUMBER 2
G_FLAG 0
CLFY_SUB bla bla
E_STRING No record(s) found
MESSAGE_ID foo bar
BUSORG_ORGID 281688
service: now I have received that...
Mon Apr 24 10:09:20 2006: service: field [XFDTRANSACT_XID2] not found, Ferror 4, tperrno 0
processing ends... Mon Apr 24 10:09:20 2006:
END:
START: Mon Apr 24 10:09:53 2006:
Mon Apr 24 10:09:53 2006: service: before tpcall(), buffer being sent...
CLFY_SUB foobar
MESSAGE_ID 1273498170sa;dooif
BUSORG_ORGID 422345
XPRODUCT_XACCOUNTNO hummm bug
XPRODUCT_XCOINTYPE foobar
END:
I am search thorugh logs(*.rv) files to find entires between two user defined dates,ie dd mm yyyy - dd mm yyy
The script so far looks for the "START" and "END" of each entry at sees if it belongs To an ORGID number. then only take the whole record based on OGID and in the a date range given
gawk '/^START/ { ok=0; sec="" } /^START/,/^END/ { sec=sec "\n" $0 }$2==281688 { ok=1 }/^END/ && ok { print sec }' *.rv>BUSORG_ORGID${BUSORG_ORGID}st${START_DAY}${START_MONTH}end${END_DAY}${END_MONTH}.txt
extract of one *.rv file
START: Mon Apr 24 10:09:19 2006:
Mon Apr 24 10:09:19 2006: service: before tpcall(), buffer being sent...
G_FLAG 0
CLFY_SUB slicker
MESSAGE_ID fooo bar foo
BUSORG_ORGID 281688
service: now I'm sending that...
Mon Apr 24 10:09:19 2006: Mon Apr 24 10:09:20 2006: service: after tpcall(), buffer received...
E_NUMBER 2
G_FLAG 0
CLFY_SUB bla bla
E_STRING No record(s) found
MESSAGE_ID foo bar
BUSORG_ORGID 281688
service: now I have received that...
Mon Apr 24 10:09:20 2006: service: field [XFDTRANSACT_XID2] not found, Ferror 4, tperrno 0
processing ends... Mon Apr 24 10:09:20 2006:
END:
START: Mon Apr 24 10:09:53 2006:
Mon Apr 24 10:09:53 2006: service: before tpcall(), buffer being sent...
CLFY_SUB foobar
MESSAGE_ID 1273498170sa;dooif
BUSORG_ORGID 422345
XPRODUCT_XACCOUNTNO hummm bug
XPRODUCT_XCOINTYPE foobar
END: