The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need Information. Will Appreciate It rapzkilla UNIX for Dummies Questions & Answers 2 06-27-2007 11:33 PM
I need a ton of information.... markforsythe AIX 1 08-02-2004 06:17 AM
NEED Some Information!!! btx High Level Programming 1 01-25-2004 03:50 PM
PHP- Information SolidSnake Shell Programming and Scripting 1 11-19-2003 07:59 AM
Need information on AIX 5.1.0.2 TheBlueLady UNIX for Advanced & Expert Users 3 08-19-2002 06:32 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-21-2006
Registered User
 

Join Date: Jun 2006
Location: Denver, CO
Posts: 4
caputring information from log

Hello all,

I am pretty new and UNIX scripting. I am trying to write a script that will caputure some information from a log, without opening a log. Can you please point me in the right direction.

Thanks,
Keyur
Reply With Quote
Forum Sponsor
  #2  
Old 06-21-2006
Registered User
 

Join Date: Jun 2006
Location: Denver, CO
Posts: 4
Here is some additional information.

The log would look something like

Quote:
INVITE: IPadress Callid: 112200
FROM
TO
CONTACT
SDP
100 Trying: IPadress Callid: 112200
FROM
TO
CONTACT
404 Not Found: IPadress Callid: 112200
FROM
TO
CONTACT
ACK: IPadress Callid: 112200
FROM
TO
CONTACT
INVITE: IPadress Callid: 112201
FROM
TO
CONTACT
SDP
100 Trying: IPadress Callid: 112201
FROM
TO
CONTACT
486 Busy Here: IPadress Callid: 112201
FROM
TO
CONTACT
ACK: IPadress Callid: 112201
FROM
TO
CONTACT
INVITE: IPadress Callid: 112202
FROM
TO
CONTACT
503 Service Unavialable: IPadress Callid: 112202
FROM
TO
CONTACT
What I want to do is write a script that will allow me to pull up information based upon callid. Lets say I want information for callid: 112201, it will display:
Quote:
INVITE: IPadress Callid: 112201
FROM
TO
CONTACT
SDP
100 Trying: IPadress Callid: 112201
FROM
TO
CONTACT
486 Busy Here: IPadress Callid: 112201
FROM
TO
CONTACT
ACK: IPadress Callid: 112201
FROM
TO
CONTACT
Thanks,
Keyur
Reply With Quote
  #3  
Old 06-21-2006
Registered User
 

Join Date: Jun 2006
Location: Denver, CO
Posts: 4
Please let me know if it is not doable. I am assuming it isnt since i havent received any responses yet.
Reply With Quote
  #4  
Old 06-21-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,016
nawk -v callid=112201 -f fossil.awk myLogFile.log

fossil.awk:
Code:
$(NF-1) == "Callid:" && $NF == callid { found=1 }
found && $(NF-1) == "Callid:" && $NF != callid { found=0 }
found

Last edited by vgersh99; 06-21-2006 at 01:40 PM.
Reply With Quote
  #5  
Old 06-21-2006
Registered User
 

Join Date: Jun 2006
Location: Denver, CO
Posts: 4
Thanks for the help. I am getting error saying:
nawk: division by zero
Reply With Quote
  #6  
Old 06-21-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,016
Quote:
Originally Posted by fossil0681
Thanks for the help. I am getting error saying:
nawk: division by zero
really? what OS are you on?

try this:
Code:
$(NF-1) == "Callid:" && $NF == callid { found=1 }
found && $(NF-1) == "Callid:" && $NF != callid { found=0 }
{ print }
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0