Monthly Archives: March 2010

Vim Search/Replace/Increment

let’s say you have this in a text file:

item
item
item

and you want to change it to this

ordered_item_1
ordered_item_2
ordered_item_3

You can do this in VIM with the following command:

let i=1|g/item/s//\=”ordered_item_”.i/|let i=i+1

You can do it even more easily using AWK but VIM forever!

Keep a task running

so you’ve got task that you want to run but you need to leave right away and you have to logout.

If you do a “command &” it will certainly run and in the background but if you logout it’ll go away. So how can you keep it running ?
With the “nohup(1)” utility. Preceed your command with nohup and end it with “ampersand &” and it will detach it from the current tty and spits the output to ‘nohup.out” in the current directory.
You can also apply this if you want to run some program and don’t want to daemonize it just yet.

This thing helped me twice in the past few days so I bet it will help you too!