Friday, November 26, 2010

Re: edit multiple files under multiple directories/folders

> As per http://pastebin.com/hkJ5U38N
> Line No 30 <Server port="8005" shutdown="SHUTDOWN"> to be changed to <Server
> port="8105" shutdown="SHUTDOWN">
> Line No 94 <Connector port="8080" maxHttpHeaderSize="8192" to be changed to
> <Connector port="8081" maxHttpHeaderSize="8192"
> Line No 119 <Connector port="8009"
>                enableLookups="false" redirectPort="8443" protocol="AJP/1.3"
> /> to be changed to
>             <Connector port="8109"
>                enableLookups="false" redirectPort="8443" protocol="AJP/1.3"
> />
> The above server.xml changes relates to tomcat1 viz... 8105,8081 and 8109
> similarly it holds true for the rest of the tomcats
> For example for tomcat2 it would be 8205,8082 and 8209 in server.xml
> Please let me know if you need more information.

The first thing that comes to my mind is using a macro. Open all the
files ( vim tomcat*/**/server.xml ), record a macro in one file( see
below ), and execute it for other files( :bufdo execute "@a" ). The
sequence would be something like this:

qa - start recording and name it a
gg - make sure we are the start of file
30G - go to line 30
4w - move 4 words, this brings cursor to 8 of 8005
100C-a - increment the number by 100 ( note C-a is Control a)
94G - the rest should be evident now
4w
C-a
119G
4w
100C-a

--
Anurag Priyam,
3rd Year Undergraduate,
Department of Mechanical Engineering,
IIT Kharagpur.
+91-9775550642

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

Post a Comment