LinuxQuestions.org
Help answer threads with 0 replies.
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 09-22-2010, 10:37 AM   #1
maestromani
LQ Newbie
 
Registered: Sep 2010
Posts: 11

Rep: Reputation: 0
Grep with two input.


Hi There,

Is there any way i can pass two / three values to grep. Basically i want to list the lines in the file with three different values. Currently I'm using three grep to get my work done.

EG: more Filename | grep text1 | grep text2 | grep text3
BRs
 
Old 09-22-2010, 10:50 AM   #2
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
Use 'egrep'.
 
Old 09-22-2010, 11:06 AM   #3
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
It's not clear what you want to achieve. If you want to match ALL three value on each line but in any order, then your command line is OK; if you have a constant order, or if the number of alternatives is reasonable, you can of course write a single regex to match everything.

Yves.
 
  


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
Bash: using file as input for grep/tail and then some.. sleipnir Programming 5 06-18-2009 05:51 PM
anything piped to grep returns "(standard input)"... why? allohakdan Linux - Software 8 09-28-2008 02:02 PM
shell script having multiple grep statements-I want input file to be read only once mukta9003 Linux - Newbie 4 08-27-2008 01:58 AM
grep input/output error on slackware 10.1 install dpp777 Linux - Newbie 1 09-07-2005 10:25 AM
utf , standard output / input and grep too Fascistchicken Linux - Software 2 11-05-2004 09:52 AM


All times are GMT -5. The time now is 12:16 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