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
How do I search for 2 strings (AND operator) ? Kartheg UNIX for Dummies Questions & Answers 14 09-11-2009 04:44 PM
how to search with 2 strings. syamkp Shell Programming and Scripting 2 03-10-2008 04:50 AM
search a logfile for strings amitrajvarma UNIX for Dummies Questions & Answers 0 11-25-2007 10:09 AM
awk search for Quoted strings (') kprattip Shell Programming and Scripting 13 07-10-2007 03:30 PM
Search for strings lesstjm UNIX for Dummies Questions & Answers 5 04-26-2002 09:58 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-12-2007
pbsrinivas pbsrinivas is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 141
Search between strings with an OR

Hi have Input in this way

KEY AAAA
BBBB
END1

KEY AAAA
BBBB
END2

KEY AAAA
BBBB
END3


I need to find any thing matching in between KEY And ending with "END1|END2|END3"

This didnot work

awk '/KEY/,/END1|END2|END3/'

how can we do this...
  #2 (permalink)  
Old 07-12-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Code:
awk -v RS="" -v ORS="\n\n" ' /^KEY/ && /END[1-3]/ ' file
  #3 (permalink)  
Old 07-12-2007
pbsrinivas pbsrinivas is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 141
anbu

actuvally

is not END[1-3]

It can be END or CLOSE of FILEEND

How do we try for those...
  #4 (permalink)  
Old 07-12-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Quote:
Originally Posted by pbsrinivas View Post
anbu

actuvally

is not END[1-3]

It can be END or CLOSE of FILEEND

How do we try for those...
Code:
awk -v RS="" -v ORS="\n\n" ' /^KEY/ && ( /END/ || /CLOSE/ || /FILEEND/ ) ' file
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 04:45 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