with following two formats
(xxx) xxx-xxxx and xxx-xxx-xxxx.
-l list only filename
grep -l -R --perl-regexp "\b(\(\d{3}\)\s*|\d{3}-)\d{3}-\d{4}\b" * > output.txt
(xxx) or xxx-
\(\d{3}\)\s*|\d{3}-
xxx-xxxx
\d{3}-\d{4}
http://www.wellho.net/regex/grep.html
http://www.robelle.com/smugbook/regexpr.html
(grep doesn't support "+" "|" "()"
(xxx) or xxx-
egrep "\([0-9]\{3\})|[0-9]\{3\}-" ./*
ls -1 list 1 file one line:
ls -1 | egrep 'DIV_(pharm|dental|vision)
perl replace "search" with "replace" and make the file as backup
perl -pi.bak -e's/searchs/replaces/' file1 file2 file3 fileN
No comments:
Post a Comment