i have a file like this :
192.168.123 hostname1
192.168.126 hostname2
192.168.125 hostname3
192.168.124 hostname4
And I want to search for a string via CMD ex. hostname2 and add a line after it so it will look like this:
192.168.123 hostname1
192.168.126 hostname2
192.168.128 hostname5
192.168.125 hostname3
192.168.124 hostname4
also it all have to be done in orginal file not moved to another
for /F "tokens=1,2" %%a in (input.txt) do (NLecho %%a %%bNLif "%%b" equ "hostname2" echo 192.168.128 hostname5NL)