Handy editing snippet

Written by Walter

This cam in handy, I'm posting it for re-use later.
Say you want to replace a variable (in my case a table class) in all files you used it before:

vim `grep -r firmware_listing * | head -n 1 | cut -d ":" -f 1`

This opens first file in vim, save ctrl-d (see vim_settings post) ctrl-c, up enter it will edit next file with that string ;). Could even use sed to do the replace but I'd rather iterate and edit to be sure not to mess things up...

Back to archive