Remove the row count from a csv file using a batch file

April 4, 2012 at 04:44:52
Specs: Windows XP
I want to remove the row count which is appearing at the end of a csv file using a batch file
I also want to remove leading commas and want to format the trailing ones.
for e.g
What I am getting:-
,Test1 ,
,Test2 ,
What I want:-
Test1,Test2

See More: Remove the row count from a csv file using a batch file

Report •

#1
April 12, 2012 at 10:18:50
Please post your code.
Thanks,
Elinor

Elinor Hurst
http://elinorhurst.blogspot.com


Report •

#2
April 12, 2012 at 22:55:02
Ok,Thanks for your reply
I am trying to extract some keywords from a stored procedure using a batch file
and saving the ouput file as a csv file.
so after the database connections(command line written in a batch file) I wrote the following line to get the output in a csv file
-ooutput.csv -s","
I got the output as shown above
I tried -W to trim spaces between the keyword and the trailing comma but didn't work.
need a solution asap
Thanks in advance.

Report •

#3
April 13, 2012 at 00:46:28
Please post your batch!

Thank you ;-)

Elinor Hurst
http://elinorhurst.blogspot.com


Report •

Related Solutions

#4
April 16, 2012 at 03:54:16
Ok
output.csv file is already created and I have used the following code
grep -v -- ----- output.csv | tr -d [:blank:] > blanks.csv
cut -c2-999 blanks.csv > final.csv
rm output.csv
rm blanks.csv
exit
Using this I am able to solve the leading and trailing commas issue
but instead of cut and grep(unix commands) I want to use Windows cmd to do it.
pls help asap

Report •

Ask Question