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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
search pattern in a string and rename deepakgang UNIX for Dummies Questions & Answers 6 06-02-2008 02:43 AM
Advance string pattern search Please sainj Shell Programming and Scripting 2 10-30-2007 10:56 AM
appending string to text file based on search string malaymaru Shell Programming and Scripting 1 06-09-2006 09:53 AM
Search a file for pattern? davjoyce UNIX for Dummies Questions & Answers 2 03-07-2006 06:07 PM
Search file for pattern and grab some lines before pattern frustrated1 Shell Programming and Scripting 2 12-22-2005 03:41 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-23-2007
krishnan_6015@y krishnan_6015@y is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 6
Search Mulitiple String pattern in a file

Hi,

I need to search for a multiple string pattern(5 key words) in a file(similar to a flat file) ,and i need to store the output in a another file .

In that file we may have mutiple occurrences of the key words.and i need only the unique.

kindly help out.


Thanks,
Mohana Krishnan
  #2 (permalink)  
Old 11-23-2007
chella chella is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 75
Quote:
Originally Posted by krishnan_6015@y View Post
Hi,

I need to search for a multiple string pattern(5 key words) in a file(similar to a flat file) ,and i need to store the output in a another file .

In that file we may have mutiple occurrences of the key words.and i need only the unique.

kindly help out.


Thanks,
Mohana Krishnan

Hi Mohana Krishnan,

I don't understand this line. Can you explain it.

In that file we may have mutiple occurrences of the key words.and i need only the unique.

To search multiple patterns in a file u can use grep with -e option.

grep -e pattern1 -e pattern2 -e pattern3 filename > newfile.

Regards,
Chella
  #3 (permalink)  
Old 11-23-2007
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
Or 'egrep / grep -E':

Code:
egrep 'term1|term2|term3'

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:48 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