Link to home
Create AccountLog in
Avatar of and235100
and235100Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Find a text string, and add some text in the line beneath it, in multiple files

Hi.

I have a folder where I have multiple .ini files. I want to add some text to each file, but beneath a line of text that is present in each file.

i.e.

Text to add - this is some text

File:

some text
some text
[Tools Packages]
>>>this is some text<<<    (Text to add here)
some text
some text

TIA.
Andrew.
Avatar of hax1
hax1
Flag of Austria image

for one file it works like this ...

FIND /C /I "string_text_to_find" C:\folder_with_ini_files\bla.ini
IF %ERRORLEVEL% NEQ 0 ECHO %NEWLINE%^TEXT_TO_ADD>>C:\folder_with_ini_files\bla.ini
ASKER CERTIFIED SOLUTION
Avatar of Paul Tomasi
Paul Tomasi
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of and235100

ASKER

Thank you to you both, but paultomasi's solution is superb and does exactly what I need.
Excellent, fast and accurate response.
You're welcome.

Thank you.