The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" iBot UNIX and Linux RSS News 0 01-04-2008 12:00 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 10:52 PM
"syntax error at line 21 :'done' unexpected." error message" ibroxy Shell Programming and Scripting 3 08-08-2007 03:45 AM
No utpmx entry: you must exec "login" from lowest level "shell" peterpan UNIX for Dummies Questions & Answers 0 01-18-2006 01:15 AM
join two lines when the second line contains "US DOLLAR" powah Shell Programming and Scripting 2 10-21-2005 03:30 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-08-2008
Registered User
 

Join Date: Nov 2006
Posts: 54
get next 2 lines after a "pattern line"

all,

I want to get next 2 lines in a file after a define pattern, for example: SALT

Input:
Quote:
blah blah blah
blah blah blah SALT blah blah blah
lineXXX
lineYYY
Output:
Quote:
lineXXX
lineYYY
anyone can help?

Last edited by fongthai; 05-08-2008 at 11:14 PM. Reason: more info
Reply With Quote
Forum Sponsor
  #2  
Old 05-09-2008
Yogesh Sawant's Avatar
Part Time Moderator and Full Time Dad
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 798
try this:
Code:
sed -n -e '/SALT/ {n; p; n; p}' filename

Last edited by Yogesh Sawant; 05-09-2008 at 12:31 AM. Reason: corrected the sed command
Reply With Quote
  #3  
Old 05-09-2008
Registered User
 

Join Date: Nov 2006
Posts: 54
It's great, Yogesh!

Thank for your help!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
sed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:48 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