Code: Select all
awk '/^0/ { print $2 }' ~/test.txt
It just finds a line beginning with a '0' eg 000000001:, then prints out the next field.
Contents of test.txt:
Code: Select all
READY....
Listening...
Stopped listening, please wait...
000000000: hello
READY....
Listening...
Stopped listening, please wait...
000000001: bye
READY....
Just outputting to test.txt, there will be several words, as the file gets constantly written to, so it probably needs to be done 'on the fly'.
(thats not genuine output BTW, not had chance to test recognition properly)
The word then needs passing to something like:
Code: Select all
case $wot_u_said in
browser)
defaultbrowser
;;
shutdown)
shutdown
;;
esac
}