Friday, December 24, 2010

Re: Modifying many lines in many files

Reply to message «Modifying many lines in many files»,
sent 23:12:59 24 December 2010, Friday
by Jeri Raye:

> Hi,
>
> I need to modify a many files, all in the same way.
> The modification is to
> - add one space-character at the beginning of every line.
> - delete the space-character at the end of every line.
>
> 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]
>
> How to do that?
>
>
>
> And I want to place this in a batch file (working on windows xp)?
>
> If I call modification described above as
> 'do the requested adding and deleting'
vim -c 'command that do the requested adding and deleting' -c wqa file.txt
For your particular task this will be:
vim -u NONE -c "%s/^\\(.*\\) $/ \\1/" -c wqa file.txt

No comments:

Post a Comment