Group more than one regular expression in the same command

妖精的绣舞 提交于 2019-12-13 08:42:57

问题


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


回答1:


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

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

should suffice.



来源:https://stackoverflow.com/questions/12921217/group-more-than-one-regular-expression-in-the-same-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!