Friday, December 24, 2010

Re: Modifying many lines in many files

> In other words:
> If the line looks like this:
> [start of line]12345 [end of line]
>
> It needs to become:
> [start of line] 12345[end of line]

XyZ gave a good solution. You can either do the file-iteration
in Vim...something like:

vim -c 'argdo %s/\(.*\) $/ \1/|wn' file[0-9].txt

or in the shell

DOS:
for %%f in (file*.txt) do @vim -c "%s/\(.*\) $/ \1/|wn" %%f

*nix:
for f in file*.txt; do vim -c '%s/\(.*\) $/ \1/|wn' "$f"; done

Various quoting and/or escaping might need to be tweaked but that
should do the general trick.

-tim

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