columcusack
asked on
Using VI - This is an easy enough for for the GURUS
Hi,
What is the command in vi to capture the line below with the IMSI value also. I have a whole log full of these and I need to grep out the reject message with the IMSI associated with it?
======== MOBILITY EVENT (G): ATTACH REJECT =========
What is the command in vi to capture the line below with the IMSI value also. I have a whole log full of these and I need to grep out the reject message with the IMSI associated with it?
======== MOBILITY EVENT (G): ATTACH REJECT =========
======== MOBILITY EVENT (G): ATTACH REJECT =========
Time : 2009-06-17 20:01:47
Node : e_Erlang__Global_pm1_12_2_1@eqmffffffs0cp2
GMM Cause : Network Failure (#17)
Details : Timeout when communicating with external node
Attach : imsi_type, gprs_attach
IMSI : 214567890890
PTMSI : N/A
RA New : 211_111005105
RA Old : 211_0265532222
Cell ID : 40434
HLR addr : 00174034464646464646
======== MOBILITY EVENT (G): ATTACH REJECT =========
Time : 2009-06-17 20:01:48
Node : e_Erlang__Global_pm1_11_2_1@eqm01s0bp2
GMM Cause : Network Failure (#17)
Details : Timeout when communicating with external node
Attach : imsi_type, gprs_attach
IMSI : 23431023436593643402
PTMSI : N/A
RA New : 23434_0301025001
RA Old : 23434_0365534001
Cell ID : 27655
HLR addr : 0017404478026593643400
ASKER
OK. Thanks for that.
Say I have 20 files called log1, log2, log3 etc etc etc
I need to capture the IMSI value from each reject message in each log file with the time value also?
Can you help with this?
Say I have 20 files called log1, log2, log3 etc etc etc
I need to capture the IMSI value from each reject message in each log file with the time value also?
Can you help with this?
Are all of the files within the same directory? Are they the only files named log*? If so cd so that you are within that directory and run the command as
grep -e <keyword1> -e <keyword2> log* >> filename2
again us IMSI and MOBILITY as the keyword log* will grep all files that are named log with characters following it. Give the filename2 a name such as queryresults or something other than log.
grep -e <keyword1> -e <keyword2> log* >> filename2
again us IMSI and MOBILITY as the keyword log* will grep all files that are named log with characters following it. Give the filename2 a name such as queryresults or something other than log.
ASKER
SunOS eqm01s14p2 5.9 Generic_118558-22 sun4u sparc SUNW,Netra-CP2300
I tried what you said and it fails each time, can you correct my error?
=== ageorge@eqm01s14p2 ANCB mobility_event_log/ready # grep -e REJECT -e IMSI mobility_event_log.* > colout.txt
grep: illegal option -- e
Usage: grep -hblcnsviw pattern file . . .
=== ageorge@eqm01s14p2 ANCB mobility_event_log/ready # grep -e REJECT -e IMSI mobility_event_log.* > colut.txt
grep: illegal option -- e
Usage: grep -hblcnsviw pattern file . . .
=== ageorge@eqm01s14p2 ANCB mobility_event_log/ready # grep -e < *REJECT* > -e < IMSI > mobility_event_log* >> colout.txt
Ambiguous input redirect.
=== ageorge@eqm01s14p2 ANCB mobility_event_log/ready #
I tried what you said and it fails each time, can you correct my error?
=== ageorge@eqm01s14p2 ANCB mobility_event_log/ready # grep -e REJECT -e IMSI mobility_event_log.* > colout.txt
grep: illegal option -- e
Usage: grep -hblcnsviw pattern file . . .
=== ageorge@eqm01s14p2 ANCB mobility_event_log/ready # grep -e REJECT -e IMSI mobility_event_log.* > colut.txt
grep: illegal option -- e
Usage: grep -hblcnsviw pattern file . . .
=== ageorge@eqm01s14p2 ANCB mobility_event_log/ready # grep -e < *REJECT* > -e < IMSI > mobility_event_log* >> colout.txt
Ambiguous input redirect.
=== ageorge@eqm01s14p2 ANCB mobility_event_log/ready #
Could you paste the command exactly as you are entering it?
ASKER
grep -e REJECT -e IMSI mobility_event_log.* > colut.txt
Oooh I just noticed from you output.. Is this a Solaris box? If so the commands parameters could be different than what is available on a Linux box.
ASKER
SunOS eqm01s14p2 5.9 Generic_118558-22 sun4u sparc SUNW,Netra-CP2300
That is correct? Can you still help?
Regards
Colum
That is correct? Can you still help?
Regards
Colum
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, this is much better :)
egrep 'REJECT|IMSI|Time' mobility_event_log.* > colout.txt
I'm just trying to include the TIME also....checking now, will let you know shortly...
egrep 'REJECT|IMSI|Time' mobility_event_log.* > colout.txt
I'm just trying to include the TIME also....checking now, will let you know shortly...
ASKER
Thanks a lot :)
Thats done it :)
Thats done it :)
ASKER
thanks a lot
Great! Glad to hear it. Now you can figure out how to automate it to run with a rotational log and you won't have to ever manually do it again. ;)
For instance
grep -e <keyword1> -e <keyword2> filename >> filename2
You could use IMSI and Mobility as keywords assuming that those are not used elsewhere in the file.