The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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-28-2007 02:33 AM
I need a ton of information.... markforsythe AIX 1 08-02-2004 09:17 AM
NEED Some Information!!! btx High Level Programming 1 01-25-2004 06:50 PM
PHP- Information SolidSnake Shell Programming and Scripting 1 11-19-2003 10:59 AM
Need information on AIX 5.1.0.2 TheBlueLady UNIX for Advanced & Expert Users 3 08-19-2002 09:32 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-21-2006
fossil0681 fossil0681 is offline
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
  #2 (permalink)  
Old 06-21-2006
fossil0681 fossil0681 is offline
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
  #3 (permalink)  
Old 06-21-2006
fossil0681 fossil0681 is offline
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.
  #4 (permalink)  
Old 06-21-2006
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
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 04:40 PM..
  #5 (permalink)  
Old 06-21-2006
fossil0681 fossil0681 is offline
Registered User
  
 

Join Date: Jun 2006
Location: Denver, CO
Posts: 4
Thanks for the help. I am getting error saying:
nawk: division by zero
  #6 (permalink)  
Old 06-21-2006
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
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 }
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0