Michael Kraus wrote:
Especially when checking for the existence of a process running...
For example:
# ps -xwa | grep process-name | grep -v grep
This will remove the grep process itself from the resultant output...
You can save yourself a lot of typing by doing this as:
$ ps -xwa | grep [p]rocess-name
The shell will convert "[p]rocess-name" to "process-name" when it feeds it to grep (I don't remember what the square brackets actually mean to the shell). But grep will still see "[p]rocess-name" in the ps output. And of course those two strings are completely different. :-)
And lets not forget the gnu tools of cut, paste, split and sort are fantastic - very great for text manipulation and hunting through logs.
I have occasional holy wars at work about cut,past,split vs. awk,sed. Pointing out things like the sed implementation of sokoban[1] is usually a good way to win, though.
:-)
-- Pete
[1] http://sed.sourceforge.net/local/games/sokoban.sed -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
