how to find a string in log-files and sort the results with bash

Apr 08, 2014 14:06



  1. grep --include=*.log -rnw . -e "what we want to find" | sort -V | less
--include={*.log, *.txt}
-r recursive
-n print number of string
-w whole word
. is a directory (current)

-V version sort. every number in the string is threatened as number, like in software versions: no {10.3, 1.4} results (as in alphabetical mode), it will sort correctly: {1.4, 10.3}

bash, programming

Previous post Next post
Up