Output of SED to a file

May 10, 2012 at 09:32:37
Specs: Windows XP
I am using SED for windows(http://gnuwin32.sourceforge.net/packages/sed.htm) to remove quotes from a .csv and write the output to a txt file

I am using the sed command in through a windows batch file,However on executing I am getting no such file or directory. Following script is able to execute but it is not able to write to a file

Content of the batch file sed

sed -e s/\"//g > xpidata_20050523-20120409FileHeader.csv >C:\test.txt

The version of GNU sed that I am using is 4.2.1. Please help

See More: Output of SED to a file

Report •

May 10, 2012 at 11:09:47
I have never used this version of sed before, but I think you have a syntax problem. Try removing the redirection before the csv file:

sed -e s/\"//g xpidata_20050523-20120409FileHeader.csv >C:\test.txt

Next, I would try surrounding the sed command with single quotes:

sed -e 's/\"//g' ......

Report •

May 10, 2012 at 11:23:50
WhenI I am using the following lines without the write command I am able to get the output

sed -e s/\"//g xpidata_20050523-20120409FileHeader.csv

I tried your suggestion sed -e 's/\"//g' xpidata_20050523-20120409FileHeader.csv

following is output that I have got

C:\Program Files\GnuWin32\bin>sed -e 's/\"//g' xpidata_20050523-20120409FileHeader.csv
sed: -e expression #1, char 1: unknown command: `''

I was going through the SED documentation its says
w filename
Write the pattern space to filename. As a GNU sed extension, two special values of file-name are supported: /dev/stderr, which writes the result to the standard error, and /dev/stdout, which writes to the standard output

Any idea how to use this in command prompt

Report •

May 10, 2012 at 21:03:16
Yeah, don't use single quotes. They aren't needed because CMD doesn't do shell expansion.

How To Ask Questions The Smart Way

Report •

Related Solutions

Ask Question