开发者

How to use grep with regex to find all the files containing a 'String'?

开发者 https://www.devze.com 2023-01-19 02:54 出处:网络
I am using SSH secure shell in Unix, I want to search file with some \'TEXT\' or string and that string is like \'PACKAGE\', followed by \'%PA%EVENTS%\'(\'PA_PACKAGE %PA%EVENTS%\')

I am using SSH secure shell in Unix, I want to search file with some 'TEXT' or string

and that string is like 'PACKAGE', followed by '%PA%EVENTS%'('PA_PACKAGE %PA%EVENTS%') this % i am assuming as in SQL*PLUS, means i a string PA can occur any where before EVENTS and EVENTS can occur any where after PA, I want to search those fi开发者_JS百科le which this REGEX matches.


I ma not sure exactly what you are hoping to match, but the following will print out the lines that contain the text "PACKAGE" followed but zero or more characters and then the text "EVENTS", from all the files in the current directory.

grep "PACKAGE.*EVENTS" *

Please give some more examples of what you want, so I can be more specific.


grep -l "PACKAGE*EVENTS" *

recursive:

grep -Rl "PACKAGE*EVENTS" *


try this: egrep -e "PACKAGE PA*EVENTS" file

0

精彩评论

暂无评论...
验证码 换一张
取 消