Solved

Using VI  - This is an easy enough for for the GURUS

Posted on 2009-07-02
13
966 Views
Last Modified: 2013-12-13
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 =========
======== 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

Open in new window

0
Comment
Question by:columcusack
  • 7
  • 6
13 Comments
 
LVL 11

Expert Comment

by:techzter
ID: 24762523
Could you use grep to grab them and drop them into another file?

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.
0
 
LVL 1

Author Comment

by:columcusack
ID: 24762940
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?
0
 
LVL 11

Expert Comment

by:techzter
ID: 24762993
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.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:columcusack
ID: 24763111
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 #
0
 
LVL 11

Expert Comment

by:techzter
ID: 24763173
Could you paste the command exactly as you are entering it?
0
 
LVL 1

Author Comment

by:columcusack
ID: 24763181
grep -e REJECT -e IMSI mobility_event_log.* > colut.txt
0
 
LVL 11

Expert Comment

by:techzter
ID: 24763198
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.
0
 
LVL 1

Author Comment

by:columcusack
ID: 24763236
SunOS eqm01s14p2 5.9 Generic_118558-22 sun4u sparc SUNW,Netra-CP2300

That is correct?  Can you still help?

Regards

Colum
0
 
LVL 11

Accepted Solution

by:
techzter earned 500 total points
ID: 24763318
Sorry I should have noticed it from your Zone postings.

Try this and see if it works better.

egrep 'REJECT|IMSI' mobility_event_log.* >colut.txt
0
 
LVL 1

Author Comment

by:columcusack
ID: 24763457
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...
0
 
LVL 1

Author Comment

by:columcusack
ID: 24763491
Thanks a lot :)  

Thats done it :)  
0
 
LVL 1

Author Closing Comment

by:columcusack
ID: 31599149
thanks a lot
0
 
LVL 11

Expert Comment

by:techzter
ID: 24763511
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. ;)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
debug as  junit test 4 83
reinstall 1 84
dot directory in FreeBSD??? 4 87
What is the meaning of mount pont? with respect to windows file server. 7 62
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question