LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-09-2012, 03:54 PM   #1
Shwetap
LQ Newbie
 
Registered: Apr 2012
Posts: 1

Rep: Reputation: Disabled
Checking for multiple patterns in Unix


Hi,

I writing a shell script to find if an object is merged to CVS head or not.Currently I am running a CVS command using the script to get an output to check the same.

eg. If the output has three specific tags... you come to know that its merged to head. If it has two or less, the code is not merged to head.

My intention is to automate the script further and get a refined output.

eg. I need help in writing a script that gives me an output "Merged to HEAD" if it finds the three tags in the output file and vice vera.


Thanks
 
Old 04-09-2012, 04:29 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Something like:
Code:
egrep 'tag1|tag2|tag3' file
?

If that's the grep you're looking for, you can then pipe it into "wc -l" and do a quick test to see if it's less than 3.
 
Old 04-10-2012, 09:46 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Instead of just posting a vague description of your text and requirements, how about posting an actual example of the input, the desired output, and any code you've tried using so far?

The more (relevant) details you give, the less time we'll have to spend guessing what you mean, and the faster you'll be able to get the help you need.


How To Ask Questions The Smart Way
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Search multiple patterns & print matching patterns instead of whole line Trd300 Linux - Newbie 29 03-05-2012 08:41 PM
Excluding multiple patterns from grep flamingo_l Linux - General 9 01-06-2011 09:05 AM
grep for multiple patterns???? lucastic Linux - Software 4 08-06-2010 07:07 PM
searching multiple patterns through Vi editor barunparichha Linux - Software 10 05-12-2009 09:39 PM
If condition for checking patterns in multiple files rattlesnakejoe Programming 5 05-07-2009 03:52 AM


All times are GMT -5. The time now is 10:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration