bash - Fastest possible grep - Stack Overflow grep -r greps recursively through directories. On multicore...

Please Visit: http://ift.tt/1ajReyV



bash - Fastest possible grep - Stack Overflow



grep -r greps recursively through directories. On multicore CPUs GNU

parallel can often speed this up.

find . -type f | parallel -k -j150% -n 1000 -m grep -H -n STRING {}





This will run 1.5 job per core, and give 1000 arguments to grep.

For big files, it can split it the input in several chunks with the --pipe and --block arguments:

parallel --pipe --block 2M grep foo < bigfile

You could also run it on several different machines through SSH (ssh-agent needed to avoid passwords):

parallel --pipe --sshlogin server.example.com,server2.example.net grep foo < bigfile

http://ift.tt/1tM4IzS

Done






from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1x7BOtx

via LifeLong Community

No comments:

Post a Comment