Thursday, May 23, 2013

bash tips

http://samrowe.com/wordpress/advancing-in-the-bash-shell/

Bang dollar-sign

!$ is the "end" of the previous command. Consider the following example: We start by looking for a word in a file
  1. $ grep -i joe /some/long/directory/structure/user-lists/list-15
if joe is in that userlist, we want to remove him from it. We can either fire up vi with that long directory tree as the argument, or as simply as
  1. $ vi !$
Which bash expands to:

  1. $ vi /some/long/directory/structure/user-lists/list-15

Thursday, May 16, 2013

grep and regular expression

http://www.thegeekstuff.com/2011/01/advanced-regular-expressions-in-grep-command-with-10-examples-%E2%80%93-part-ii/

http://www.cyberciti.biz/faq/grep-regular-expressions/