Open a csv file in DOS

batch-filecsvdos

Is it possible to open a csv file such as:

a,b,c,d,e,f,g,h

And have DOS read it in (in a batch file), check the data and then remove it from the file under a certain condition?

Pseudo code:

open csv file
for each letter
    if letter is e
        remove e from csv file
close and save csv file

EDIT:

If I change my data source from a csv to this:

a
b
c
d
e
f
g
h

Then I can call this:

rename file.txt file.bak
        for /f %%a in (file.bak) do (
            set hmm=%%a
            if !hmm!==e set hmm=helloworld
            echo !hmm! >> file.txt)

Although this will print out the original data after the new changes like so:

a
b
c
d
helloworld
f
g
h
a
b
c
d
e
f
g
h

Best Answer

With FOR /F, you can go through a text file and process the content of each column (called tokens), where you can choose what character is separating the columns.

In order to remove it from the file, I guess you'd have to recreate a new file where you decide what to write and what to not write.