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

In UNIX, what is the command to edit contents of the file?

9 Answers  


Does cp command overwrite files?

0 Answers  


what will be the output of ls ~/..

27 Answers   ABC,


Using unix command how to display no of records in oracle?

0 Answers  


What is {} in find command?

0 Answers  






what do you understand bythe term 'de-mountable volumes'?

2 Answers   Infosys,


How to install scsi driver in unix? give me explanation clearly?

1 Answers   HCL, TCS,


Is it inbetween or in between?

0 Answers  


what is tar command and what are the different types of tar commands?

5 Answers  


Hi All, Can you please let me know how to grep for a particular pattern in unix. I want to print the dates from the file exp.txt. the date pattern is DD:MM:YYYY, I just want to print all the dates from the file exp.txt.

8 Answers   Concentrix, IBM, Symantec, TCS,


What is the use of pipes?

4 Answers  


what is Online(STM) and offline diagnostics in HP-UX?

2 Answers   HP,


Categories