Wednesday, January 18, 2012

Re: deleting characters in multiple files?

On 17 Jan 2012, Charles Campbell wrote:
> Anthony Campbell 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?
> vi [list-of-files]
> qa
> (record keystrokes here)
> :wq
> :n
> q
> 400@a
>
> will repeat the keystrokes 400 times. Repeat as needed.
>
> Regards,
> Chip Campbell
>

Thanks to everyone for replies. I'm sure I ought to learn some Perl and
no doubt this is an oppprtunity, but Chip's solution worked perfectly. I
was pretty sure there must be something on those lines but couldn't
quite figure it out. Excellent!

Anthony

--
Anthony Campbell - ac@acampbell.org.uk
Microsoft-free zone - using Linux
http://www.acampbell.org.uk - book reviews,
articles, blog, and printed books and ebooks

--
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: