Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Help with AWK to extract text block

Original Message
Name: mjdunn
Date: December 16, 2007 at 18:59:05 Pacific
Subject: Help with AWK to extract text block
OS: Solaris
CPU/Ram: SunSparc / 4096
Model/Manufacturer: Sun Apache
Comment:
Hi there
I am hoping you could help me with a script that would search for a word and extract the block of text containing it.
This is a log file containing multiple messages.
I would like to first search for a keyword, ("bwSipRequestTimeOutReceived")and then extract the lines of text containing it. Each log is seperated by a blank line.See below as an example of lines of text of the message

any help with awk or similar command to acheive this would be greatly appreciated.
Thankyou very much

3234049,1197578062818,1,0,false,
"bwSipRequestTimeOutReceived",
"as1",
"Application Server",
"SIP",
"SIP respond 408 Request Timeout received.
Response Message:
SIP/2.0 408 Request Timeout
Via:SIP/2.0/UDP 218.101.55.1:5060;received=218.101.55.1;branch=z9hG4bK-BroadWorks.218.101.55.1-218.101.55.201V5060-0-714830972-479130644-1197578053878-
Call-ID:BW093413878141207-1215374075@218.101.55.1
From:<sip:+xxxxxxx@218.101.55.1;user=phone>;tag=479130644-1197578053878-
To:<sip:011691yyyyyyyyy@csps.softswitch.ddddddd.net:5060;user=phone>;tag=2891-587c
CSeq:714830972 INVITE
Content-Length:0



Report Offensive Message For Removal


Response Number 1
Name: Ankit Jain
Date: December 16, 2007 at 20:07:30 Pacific
Subject: Help with AWK to extract text block
Reply: (edit)
i think this may work, but will need some manipulation.

FILE="path of log file"
SEARCH="\"bwSipRequestTimeOutReceived\""
cat $FILE | \
while read line
do
index1="`awk -v a="$line" -v b="$SEARCH" 'BEGIN{print index(a,b)}'` "
if [ index1 -ne 0 ] ;
then
echo $line
fi
done


Jain Sahab


Report Offensive Follow Up For Removal

Response Number 2
Name: FishMonger
Date: December 17, 2007 at 10:50:21 Pacific
Subject: Help with AWK to extract text block
Reply: (edit)

perl -00 -ne 'print if /bwSipRequestTimeOutReceived/' file.log


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Help with AWK to extract text block

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




Batch File- Current Date in Excel

how to setup call of duty to joytok

WindowsME / HotMail Problem

Corrupt memory

Convert fat32 to Ntfs


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC