用xargs加速grep

| No Comments | No TrackBacks

xargs有个开关-P,意思是同时启动多少个子进程。借助xargs的这个特性可以加速grep文件的速度。例如,

grep  -r "libm.so.2" *

可以改写为

find . -type f | xargs -n 1 -P 20 grep "libm.so.2"

这样就会有20个进程同时查找了。

No TrackBacks

TrackBack URL: http://mtblog.jianingy.com/mt-tb.cgi/228

Leave a comment

October 2008

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Friends' Links

Archives

Powered by Movable Type 4.21-en