Batch script to copy one cloum data to file

Microsoft Windows xp professional (upgr...
December 29, 2009 at 01:57:48
Specs: Windows XP
Hi ,

i am new to Batchscripting. can anyone help me to resolve the below issue.

I have some files in c:\SCM directory. please find below of them.
Strom_u.dat
Strom_G.dat
Strom_C.dat

in Strom_u.dat we have data like:
1001|Nagi|SE
1002|Hari|SSE
1003|Chakri|PL

now i want to create a file in the same path like :
1001|Strom_U
1002|Strom_U
1003|Strom_U

Thanks in Advance.

Regards,
Nagi.


See More: Batch script to copy one cloum data to file

Report •


#1
December 29, 2009 at 12:28:47
@echo off >newfile & setlocal enabledelayedexpansion
for /f "tokens=* delims=" %%a in ('dir /b /a-d strom*.dat') do (
set fnm=%%~na
echo processing !fnm!
for /f "tokens=1 delims=^|" %%b in (%%a) do (
>>newfile echo %%b^|!fnm!)
)
goto :eof

Report •
Related Solutions


Ask Question