The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Come and work for me! (UK) TonyChapman Linux 2 03-25-2008 02:08 AM
How does it work? nat123 Linux 1 11-04-2007 10:13 PM
Script doesn't work, but commands inside work cheongww UNIX for Dummies Questions & Answers 2 11-14-2006 07:52 PM
How does tee work Foxgard UNIX for Dummies Questions & Answers 1 06-18-2005 12:58 PM
Will this work? Ypnos Shell Programming and Scripting 5 07-24-2003 10:51 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-20-2007
Registered User
 

Join Date: Sep 2006
Posts: 55
how does this work....

1|foo|bar
2|usa|ll
3|usa|vg
4|usa|vg
5|bar|vg
6|usa|vg
7|usa|ll
8|uk|nn
9|foo|manu|bar
10|uk|bb
11|foo|mm
12|kuwait|jkj
13|kuwait|mm
14|dubai|hh

awk '/foo/,/bar/' test_file1----command run at the prompt

output should have been the first 3 lines......

1|foo|bar
9|foo|manu|bar
11|foo|mm
12|kuwait|jkj
13|kuwait|mm
14|dubai|hh
Reply With Quote
Forum Sponsor
  #2  
Old 02-20-2007
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
Code:
awk '/foo/,/bar/' test_file1
It will print lines containing foo to lines containing bar.If it is not able to find the second pattern it will print till the end of the file.
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 09:44 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