1.

Solve : copying certin segment's from a file?

Answer»

im trying to copy certin segment's from files to save as delimted txt files.

item_begin armor 33 [small_shield] item_type=armor item_end
item_begin weapon 634 [short_sword] item_type=weapon item_end
so on and so on

to look like this

[small01_shield] = 33
[short_sword] = 634

thing is i can do this in excel, a batch is so much faster. i was lookin thu the "for command" but it really didn't stick. and the "copy command" didnt go futher either. maybe 1 of u guy/gal might shed some light this way.
O by the way Happy NEW year.This will parse the line and display it to the CONSOLE:

Code: [Select]@echo off
for /f "tokens=1-4" %%w in (test.txt) do echo %%z = %%y

If you want to output the data to a FILE, USE redirection:

Code: [Select]@echo off
for /f "tokens=1-4" %%w in (test.txt) do echo %%z = %%y > output.dat

Hope this helps. 8-)



Discussion

No Comment Found