Tips tagged ksh


-11

Tip #42   Count total number of occurances of a string in all files in the

#!/bin/ksh

#KSH only.
# Author: simonvc
# Purpose: Count the total number of occurances of a pattern in all files in the cwd.
# Alt: you could also do "$(grep $pattern * | wc -l) but where's the fun in that ;-)


pattern="WHATEVER"

$ echo $(($(grep -hc $pattern *| tr "\n" "+")"0"))
Read more »

4

Tip #48   Check low space

Mail somebody about space running low in some path (ksh, bash):

Read more »