0

How to group two regular expression in one command

example if have a file like:

age22
Helwan University Engineering Faculty
ITI-intake33
bye FOr NOW
i am mahmoud 34
mie 4
a

And I want to search for the line that start with by and end with W ???

Using grep command

shellter
  • 36,525
  • 7
  • 83
  • 90
chaster 87
  • 35
  • 4

1 Answers1

3

You don't need more than one regular expression for this.

grep '^by.*W$' filename.txt

should suffice.