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

有帮助吗?

解决方案

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

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

should suffice.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top