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

Suppose 1000 processes are running on the system out of those if you have to show only certain process ids which command will you use?

5 Answers  


what are processor execution levels and priorities?

2 Answers   Infosys,


fork in unix ?

4 Answers   BFL,


Why is it called grep?

0 Answers  


what does a process mean?

7 Answers   Infosys,






what is the difference between SED and GREP ? Which one is more better and why?

4 Answers   IBM,


what is the difference between KILL and KILL -9?

5 Answers   Informatica, Nutanix,


how to find largest file?

14 Answers   HCL, Microsoft, Thomson Reuters,


the difference between a soft link and a hard link?

6 Answers  


distinguish between physical addresses and logical address?

23 Answers   College School Exams Tests, CTS, Infosys, SAX, TATA, TCS,


how will you convert a general file to a hidden file?

4 Answers  


Is there any method to erase all files in the current directory, along with its all sub-directories, by using only one command?

0 Answers  


Categories