Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi guys,
The input file is coming like
ddddddd
zzzzzzz
ROW_NUMBER,NAME,SAL
1,aaa,5000I need to read data from the file from the column name ROW_NUMBER.
Expecting result:
ROW_NUMBER,NAME,SAL
1,aaa,5000can you guys help me out with any batch file script for doing this.
Any help will be appreciated.

If you need to get the row"ROW_NUMBER,NAME,SAL" and all the rest, try this:
===============
@echo off > newfile & setLocal enableDELAYedexpansionset S=
for /f "tokens=*" %%a in (myfile) do (
if "%%a" equ "ROW_NUMBER,NAME,SAL" set S=S
if !S! equ S (
>> newfile echo %%a
)
)
=====================================
Helping others achieve escape felicityM2

Thanks for ur response
we are able to create a new file but it is not reading the data from the old file..like the below data is not fetching..
ROW_NUMBER,NAME,SAL
1,aaa,5000Could you please check the code again


I checked it before I posted it.
What is in newfile?
=====================================
Helping others achieve escape felicityM2

The above code is working fine for me. but
The code is based on whole column header like ROW_NUMBER,NAME,SALI just want to search based on only one column name ROW_NUMBER,and also my file name is coming like
myfile_yyyymmdd format.means the file name is not coming with fixed name .
Can we read some thing like myfile _ *.* ?Thanks for ur quick response

I'm not with you. The file name is arbitrary.
=====================================
Helping others achieve escape felicityM2

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |