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
manipulate data with specific format tonet Shell Programming and Scripting 5 04-25-2008 08:24 AM
extract and format information from a file sujoy101 Shell Programming and Scripting 12 04-16-2008 03:58 AM
Anyways to find sentences with data format and extract it??? cyberray Shell Programming and Scripting 4 10-30-2007 08:22 PM
extract some specific text file urgent pls reyazan UNIX for Dummies Questions & Answers 2 10-20-2005 06:36 AM
extract specific lines from file apalex UNIX for Dummies Questions & Answers 2 05-15-2001 06:57 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 01-16-2008
Registered User
 

Join Date: Jan 2008
Posts: 18
Thanks to this thread, awk: need to extract a line before a pattern I finally managed to extract out the data that I wanted.

Code:
awk '$0~/Start Time/{lineno=NR; text=$0} NR==lineno+6 && $0~/send messages/{print text}' filename
That will extract out the Start Time if line 6 contains 'send messages'.

Using matrixmadhan's code :

Code:
sed -n '/Start Time/s/^.*CDATA\[\(.*\)]].*$/\1/p' filename
the timestamp is extracted.

Thanks!
Reply With Quote
Google The UNIX and Linux Forums
Forum Sponsor
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:22 AM.


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