Tuesday, January 17, 2012

Re: deleting characters in multiple files?

On Tue, Jan 17, 2012 at 11:11 AM, Anthony Campbell <ac@acampbell.org.uk> wrote:
> I  want to modify a large number of files (400+).
>
> I can semi-automate this as follows by recording the keystrokes: (1)find
> a  particular word, (2)delete a character that follows that world,
> (3)repeat for a second instance of the character, (4)save the file, and
> (5)load the next file in the list.
>
> This is pretty quick for half a dozen files but not for over 400. I feel
> sure there must be some way to fully automate this (perhaps with argdo?)
> but I can't figure out how. Is it possible?

This may be heresy on a vim mailing list, but perhaps you could script
it in perl?

perl -pi -e 's/word(char)/word/; s/$1//'

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: