Shellscript to monitor a log file if keyword triggers then execute a command?
tail -fn0 logfile | \ while read line ; do echo “$line” | grep “pattern” if [ $? = 0 ] then … do something … fi done
tail -fn0 logfile | \ while read line ; do echo “$line” | grep “pattern” if [ $? = 0 ] then … do something … fi done
Use &pattern command within less. From the man page for less &pattern Display only lines which match the pattern; lines which do not match the pattern are not displayed. If pattern is empty (if you type & immediately followed by ENTER), any filtering is turned off, and all lines are displayed. While filtering is in … Read more