Wednesday, July 14, 2010

using sed in alias in C shell

Using sed commands in your .alias file in C shell is always tricky. One example of the same is:

alias grf 'set fileNline = `echo "\!*" | sed -e "s/\([^ ]*\):\([0-9]*\):.*/+\2 \1/"`;gvim $fileNline'

This alias is called as:

grf file:line_num:

and then it open the file "file" in gvim with cursor at line "line_num".

No comments: