July 22, 2004

pcregrep VS grep::[Misc]


Liang

since grep can't support binary or extend-coding, I change most of my scripts to pcregrep.
To my surprise, the script runing much faster after I switch to pcregrep:

Here is a example:

mcfarm:~/work/rootfit/background-only-step1/output$ time pcregrep 1000 exper.1.data > /dev/null
0.940u 0.030s 0:00.97 100.0% 0+0k 0+0io 103pf+0w
mcfarm:~/work/rootfit/background-only-step1/output$ time grep 1000 exper.1.data > /dev/null
28.350u 0.470s 0:29.45 97.8% 0+0k 0+0io 155pf+0w

0.94 VS 28.35 !!!

Generally say, pcregrep is more than 20 times faster then grep.


pcregrep searches files for character patterns, in the same way as other grep commands do, but it uses
the PCRE regular expression library to support patterns that are compatible with the regular expressions
of Perl 5. See pcre(3) for a full description of syntax and semantics.

If no files are specified, pcregrep reads the standard input. By default, each line that matches the pat-
tern is copied to the standard output, and if there is more than one file, the file name is printed
before each line of output. However, there are options that can change how pcregrep behaves.

Posted at July 22, 2004 11:20 PM by Liang at 11:20 PM | Comments (0) | TrackBack(0) | Booso!| Niu.la收藏!


Trackback

You can ping this entry by using http://www.wespoke.com/cgi-bin/mt/mt-tb.cgi/542

Comments

Post a comment

请注意,为了防止spam,您的留言必需含有中文字符!









Remember personal info?




所有发表