Re: find與egrep的正規表示法的應用
On Oct 5, 4:25 pm, Maxsolar....@OfO.twbbs.org (Astro v.s. Geo) wrote:
> (snip)
First of all, I've never used this switch -regex but I'm interested.
And the man-page says:
"This is a match on the whole path, ..."
So, the leading "./" is relevant to the match and you should not have
used "^[0-9]..."
mkdir /tmp/x
cd /tmp/x
mkdir 2000/ 19991102_010129/ 19991025_091203/ 19990824_090817/
chen@cpq2200:/tmp/x$ find . -regextype posix-egrep -type d -regex "^.*
[0-9]{7,}[_][0-9]{5,}$"
../19990824_090817
../19991025_091203
../19991102_010129
chen@cpq2200:/tmp/x$
PS1. The switch "-regextype posix-egrep " should be put before "-type
d".
PS2. Many people are referring to some "find -E" but I do not have
one.
PS3. I am running Debian/etch/2.6.27.35
regards
rudi
Linux 近期熱門文章
21
56
PTT數位生活區 即時熱門文章