Fetching colum data with concat file Name

Closed
Nagireddy - Dec 29, 2009 at 03:52 AM
 Hawk - Dec 31, 2009 at 08:59 AM
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.
Related:

1 response

You can try this,

Put the bat file in the same folder.

@echo off
for /f "tokens=* delims=" %%h in ('dir/b/a-d "Your folder path" ^| find ".txt"') do (
for /f "tokens=1-6 delims=|" %%n in ('findstr /i /c:"|" "%%h"') do echo %%n^|%%~nh >> newfile.txt
)
)


Regards - Pradeep
0