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
cp -r excluding certain directories? sarnobat Shell Programming and Scripting 2 01-13-2009 07:30 PM
printing strings in one X number of times from another dcfargo Shell Programming and Scripting 5 06-16-2008 05:48 PM
Secondary groups show in groups but don't show in id (Not working) zen03 HP-UX 4 12-31-2007 11:15 AM
How to concatenate two strings or several strings into one string in B-shell? fontana Shell Programming and Scripting 2 08-26-2005 11:58 AM
excluding directories while using tar uchachra UNIX for Dummies Questions & Answers 2 03-12-2002 02:38 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 03-20-2009
marcpascual marcpascual is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 35
excluding two or more groups of strings from printing

sample text:

001 the quick brown fox jumps 987 over a lazy dog
002 the quick brown fox jumps 999 over a lazy dog
003 the quick brown cow jumps 888 over a lazy dog
004 the quick brown fox jumps 777 over a lazy dog
005 the quick brown fox jumps 666 over a lazy cat

i want to do something like:

cat text | egrep -v ""brown fox"|"lazy dog"" (ofcourse this doesn't work)
which should yield:

003 the quick brown cow jumps 888 over a lazy dog
005 the quick brown fox jumps 666 over a lazy cat

TIA,
Marc
  #2 (permalink)  
Old 03-20-2009
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,390
try this.......
Code:
awk '/brown fox/||/lazy dog/{print}' filename
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 02:15 PM.


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