Give a regular expression that finds two things, try to
come up with regular expressions that find each
individually using "egrep" command?

Answers were Sorted based on User's Feedback



Give a regular expression that finds two things, try to come up with regular expressions that find..

Answer / manikantan t s

egrep -e <expresseion 1> -e <expression 2> <file name>

Is This Answer Correct ?    5 Yes 1 No

Give a regular expression that finds two things, try to come up with regular expressions that find..

Answer / shammi

Suppose yu have file name k.txt

naf@warsteiner:~:>cat k.txt
My name is harish
My name is Mark

Now naf@warsteiner:~:>egrep '(harish|Mark)' k.txt
My name is harish
My name is Mark

Is This Answer Correct ?    3 Yes 1 No

Give a regular expression that finds two things, try to come up with regular expressions that find..

Answer / niranjan

Gud command egrep but it not available in all unix flaviours.

grep -e option do the same as egrep

syntax:-
egrep 'pattern1|pattern2|pattern3' filename

grep -e 'pattern1' -e 'pattern2' -e 'pattern3' filename

Is This Answer Correct ?    2 Yes 0 No

Give a regular expression that finds two things, try to come up with regular expressions that find..

Answer / jsdkar

using egrep

Is This Answer Correct ?    0 Yes 0 No

Give a regular expression that finds two things, try to come up with regular expressions that find..

Answer / linuxdemon(vjsujay@gmail.com)

vjsujay@vjsujay-desktop:~/test$ cat jsk
cake
coke

vjsujay@vjsujay-desktop:~/test$ egrep 'c(a|o)ke' jsk
cake
coke

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More Unix Commands Interview Questions

What is unix command?

0 Answers  


in unix echo is used for

10 Answers   BFL, BirlaSoft, Patni,


what is the use of nice command?

4 Answers  


distinguish between interrupts and exceptions?

2 Answers   Infosys,


What is the pipe command?

0 Answers  






What is the difference between pipe and xargs?

2 Answers   Amazon, CTS,


What command is used to replace the existing string with some other?

8 Answers   TCS,


Which command is used to copy files?

0 Answers  


How to check whether some services are running in another server or not? Suppose i am currently in a server named A.I want to check whether some services are running in server B without logging into the server B.

3 Answers   Amazon, MBA, Syntel, TCS, Unisys,


Is there a way to erase all files in the current directory, including all its sub-directories, using only one command?

0 Answers  


Which command will print your home directory on screen?

0 Answers  


How will you know who are the users logged in to the system before 15 minutes?

4 Answers   Amazon,


Categories