Batch file to search for and delete lines containing specific text

batchcsv

I have a bat file that searches a directory for specific .csv files names, and copies and amends the lines into a new .csv file.

However, some of the lines of the original .csv files are not information needed, and begin with PO-. I'd like to add to my bat a way to search for cells containing "PO-" and delete the entire line, and then save the results in a new .csv file. Is it possible?.

What I have so far in my .bat file is:

REM

@ Echo off

Echo on

type NUL>fdx.csv

copy pds*.csv fdx.csv

Best Answer

Perhaps you could use FIND

find /V "PO-" fdx.csv > new.csv

but you will get a header on the csv file that you have to remove manually

Related Question