this has to be done in batch.
I need to be able to read an input file, and parse out certain sections only of lines that contain a specific string, then write that to an output file. For example:
input =test.properties file
SQL
Datamodel
sale_detail.sql
bpid_exclusion.sql
expected output =
SQL
Datamodel
sale_detail.sql
bpid_exclusion.sql
This is what I have so far:
@setlocal enableextensions enabledelayedexpansion
set
log_filepath=PATH/config.sql
FOR /F "usebackq tokens=* delims=" %%A IN (test.properties) DO (
set temp=%%A
ECHO %%A >> %log_filepath%
The problem I have right now is that when I run this script, it's printing the complete properties file, but what i want is after reading the file it should check if the word SQL exists in the file or not if yes it should check for the next word datamodel if data model exists it should print the next two lines which is sale_Detail.sql and bpid_exclusion.sql in the log_filepath