How to find and replace with a new line character in windows gvim?
It is very easy to find and replace with a new line in windows gvim. In linux EOL ie., "End Of Line"
character will be "\n" but in windows it is "\r\n". "\r" character is called as carriage return. Just visualize
old type writer machine carriage return. Now when it comes to find and replace with a new line using
windows is by the following steps,
1)Go to command mode by pressing "Esc" key.
2)Find and replace with a carriage return instead of a new line character. ie.,
:s/SearchText/\r/gc
For linux users, find and replace with a new line. ie.,
:s/SearchText/\n/gc
I was in software industry since 2007. In this blog i am writing some tips i know from my personal experience for people who are in this software profession.
Sunday, September 19, 2010
How to start another batch file in separate process?
Consider a usecase like when you trying to start a apache/tomcat server using a batch file. After starting the server the batch file will stop thare. Meaning if you have the following in a batch file a.bat,
a.bat:
call c:\Installs\Tomact\bin\run.bat
time
unzip a.zip
then the command unzip and time will never executed. In that case starting a new command prompt and call those command via another batch file is possible and it is easy.
Split the above batch file into two batch files namely a.bat and b.bat with content as follows,
a.bat:
call c:\Installs\Tomact\bin\run.bat
b.bat:
time
unzip a.zip
Now write a another batch file with name c.bat as follows,
c.bat:
start call a.bat
start call b.bat
Now running the c.bat file will run both the batch files will run in separate process and all the commands are executed.
a.bat:
call c:\Installs\Tomact\bin\run.bat
time
unzip a.zip
then the command unzip and time will never executed. In that case starting a new command prompt and call those command via another batch file is possible and it is easy.
Split the above batch file into two batch files namely a.bat and b.bat with content as follows,
a.bat:
call c:\Installs\Tomact\bin\run.bat
b.bat:
time
unzip a.zip
Now write a another batch file with name c.bat as follows,
c.bat:
start call a.bat
start call b.bat
Now running the c.bat file will run both the batch files will run in separate process and all the commands are executed.
How to delete a line which contain matching text line using vim?
It is easy to delete all lines which have matching text at one shot. For that you have to change the mode to command by presssing "Esc" key.Then type
:g/match text/d
thats it. All the lines which contain the "match text" will be deleted. This is tested with windows gvim.
:g/match text/d
thats it. All the lines which contain the "match text" will be deleted. This is tested with windows gvim.
Subscribe to:
Posts (Atom)