Kindly clarify the programming

March 28, 2012 at 07:55:35
Specs: Windows XP
dos tool to extract a column from text file

:: EX3.BAT Usage: ex3 "G:\Preusage\OR_DLY_PRE_USAGE.txt"
@echo off > "%~dpn1.new"
for /F "tokens=3 delims=," %%j in ('type "%~1"') do echo.%%j>> "%~dpn1.new"
:: End_Of_Batch

Where do I put source file name and destination file name... would love an example.

My file and path are G:\Preusage\OR_DLY_PRE_USAGE.txt


See More: Kindly clarify the programming

Report •


#1
March 28, 2012 at 08:19:42
ex3 G:\Preusage\OR_DLY_PRE_USAGE.txt

It will save the new file in that path with a .new extension.

Tony


Report •

#2
March 28, 2012 at 08:38:35
@(@for /F "tokens=3 delims=," %%j in (G:\Preusage\OR_DLY_PRE_USAGE.txt) do @echo.%%j)> "G:\Preusage\OR_DLY_PRE_USAGE.new.txt"

How To Ask Questions The Smart Way


Report •

#3
March 29, 2012 at 03:46:24
Thanks to both of you.... I am a complete novice in this.. would like to have ur help in write the complete program for me to create a batch file to extract a particular column from a database in *.txt format.

Report •

Related Solutions

#4
March 30, 2012 at 08:28:18
whats the format in the text file? is it

item1,item2,item3

if thats the case you can use %%J %%K and %%L to minipulate those

for example if you wanted to put item2 in each line into a text file you could use

echo %%K >> newfile.txt

mike


Report •

Ask Question