Removing a string of text from a .csv file?

November 19, 2010 at 10:34:07
Specs: Windows 7
I've got a .csv files with two columns, column A contains this info -

en1g7f0b1|general/tcp|24760|NOTE|Windows Content Checks :Results found
en1g7f0b1|general/tcp|24760|NOTE|Windows Content Checks :Results found
en1g7f0b1|general/tcp|24760|NOTE|Windows Content Checks :Results found

and the second column -

added c:\windows\fonts\8514fixe.fon;;
added c:\windows\fonts\8514fixg.fon;;
added c:\windows\fonts\8514fixr.fon;;

The first 9 characters of column A change throughout the large csv file and I need to keep those, but only those. I want to remove the entire line "|general/tcp|24760|NOTE|Windows Content Checks :Results found"

Everything I've tried bombs out. Any suggestions would be much appreciated!!


See More: Removing a string of text from a .csv file?

Report •

#1
November 19, 2010 at 11:05:25
I assume you mean remove the rest of column A; not the whole rest of the line.

===============================================

@echo off > newfile & setLocal enableDELAYedeXpansion

for /f "tokens=1-2 delims=," %%a in (my.csv) do (
set A=%%a
set A=!A:~0,9!
>> newfile echo.!A!, %%b
)


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
November 19, 2010 at 12:42:00
beautiful. you are the man.

Report •
Related Solutions


Ask Question