Bash pipe fun
Posted: 16 September 2010 Filed under: productivity | Tags: bash, command line, linux 1 CommentHow about “recursively look at a log of hostnames used to request my site content. Sort them and ensure that only unique ip address and hostname combinations are counted. Find how many use my ‘.biz’ hostname to land on my site”:
find . -iname '*ecommerce-host_log*' | nice cat | nice xargs cut --delimiter=' ' -f 1,4 | nice sort | nice uniq | nice grep \.biz | nice wc -l
I wasn’t sure which commands would be most processor-intensive, so I used “nice
” liberally.
Nice! 🙂
It might also work to just adjust priority for the shell in which you’re running these commands, like so:
renice 10 -p $$