Need to split up a file into multiple files using DOS commands

I have a txt file with lines delimited by < and >. Each line begins with < and ends with > (quotes not included in the file).

I need to split up each line within these tags to a new file using DOS commands. There are different symbols like | and spaces in each line which should be ignored.

Only beginning < and ending > should be taken into account for creating new files.

How can this be done?

Answers


Following code should do it. File name may also be extracted from line content.

setlocal enabledelayedexpansion
set IDX=1
for /f "delims=<> tokens=1" %%L in (myfile.txt) do (
echo %%L>file!IDX!.bat
set /A IDX+=1
)

Need Your Help

How do you reindex an array in PHP?

php arrays indexing

I have the following array, which I would like to reindex so the keys are reversed (ideally starting at 1):

Allow a trailing slash in a Clojure function name

clojure

For a DSL I'm implementing, I'd like to create a =/ function (which would be like not=).