I am hoping to get some help with a script to pull certain fields from a log file.
User update (xx6xxx P) rpt (yy6yyy B) 2010/01/20 21:36:01.298
Remote client forward start streamid 85af 2010/01/20 21:36:01.307
rpt2 (ZZ6ZZZ G) rpt1 (YY6YYY B) urcall (CQCQCQ ) mycall (W1AW)
user message (hamradio message ) mycall (W1AW) streamid 85af
hdr f 400000 r2 XX6XXX G r1 YY6YYY B ur CQCQCQ my KB6OYA P/91AD fc 5462 OK
Stream end streamid 85af cnt 272 missed 0 2010/01/20 21:36:06.701
Above is a snip from a log file. I am looking to pull the info from in between the "()" after the field "mycall". I am also looking to pull the field after "user message" and the time stamp at the end of the line starting with "Stream end". This information changes frequently depending on use of the system.
Should look like this:
W1AW hamradio message 2010/01/20 21:36:06.
Also, the data after the mycall should not print out twice.
The format of the log file is not clear.
Is there one message set per logfile or are there multiple messages per logfile?
Is there anything else in the logfile in a different format?
Is the message set one long message wrapped or multiple distinct lines?
This log file is generated as users transmit on a ham radio data repeater.
Below is another sample from the log file. I separated the sections that denote a given set of information that I need to pull data from. The log file is a constant stream of information. The data sets below are somewhat unique in that they dont occur unless users are accessing the system.
When a user starts a transmission the log generates a line starting with "Remote client start" or "Remoter gateway tx start" then a stream id and a time stamp. When the user stops transmitting the log generates a line starting with "Stream end" or "Remote gateway tx end" , streamid then time stamp.
Im looking to grep or awk the information after "mycall" on the line starting with "user message", in between the "()", the "user message" between "()" and the time stamp at the end of "Stream end" line.
None of the data should occur twice in the final output. That way I have a user list with no duplicates when the script is run.
I wish I could articulate what I looking for a little better.
User update (KI6KQU S) rpt (KI6KQU S) 2010/01/21 19:38:34.765
User update (W6SAT ) rpt (KI6KQU B) 2010/01/21 19:39:05.595
Remote client forward start streamid 2511 2010/01/21 19:39:05.604
rpt2 (KI6KQU G) rpt1 (KI6KQU B) urcall (CQCQCQ ) mycall (W6SAT /TED )
user message (ID-800 ) mycall (W6SAT ) streamid 2511
Stream end streamid 2511 cnt 18 missed 0 2010/01/21 19:39:05.917
Remote client forward start streamid 8235 2010/01/21 19:39:12.860
rpt2 (KI6KQU G) rpt1 (KI6KQU B) urcall (CQCQCQ ) mycall (W6SAT /TED )
user message (ID-800 ) mycall (W6SAT ) streamid 8235
Stream end streamid 8235 cnt 19 missed 0 2010/01/21 19:39:13.202
Remote gateway tx start (REF012 A) streamid 0019 hdr BAD 2010/01/21 19:39:20.152
rpt2 (KI6MGN G) rpt1 (REF012 A) urcall (CQCQCQ ) mycall (W6SAT /TED )
user message (ID-800 ) mycall (W6SAT ) streamid 0019
Remote gateway tx end (REF012 A) streamid 0019 cnt 22 missed 0 2010/01/21 19:39:20.541
Remote gateway tx start (REF012 A) streamid 7d0b hdr BAD 2010/01/21 19:39:25.024
rpt2 (KI6MGN G) rpt1 (REF012 A) urcall (CQCQCQ ) mycall (W6SAT /TED )
user message (ID-800 ) mycall (W6SAT ) streamid 7d0b
Remote gateway tx end (REF012 A) streamid 7d0b cnt 14 missed 0 2010/01/21 19:39:25.289
Linked gateway list: 2010/01/21 19:39:33.380
remote gateway 209.112.244.26:20001 call REF012 A status Linked to B
Last heard list: 2010/01/21 19:39:33