Try using the 'tr' option - this is replacing any string to anything u want
at your case you need to replace <SPACE>" with "
the syntax should be somthing like: | tr ' ' '"'
this will replace the space with quote ""
thanks for yoru resposne but I am totally new to sed and unix, would it be possible for you to give me the entire sed command that i can try.
Btw, i did try the sed command that I am typing below and it deleted every space even in between for e.g the original data was "123 Main Street" and after the command I used it became "123MainStreet".
complicating the uncomplicated things.....
sed -e 's/"/"/g' inputfile>outputfile...
in case u have read the request is to act on file and not on echo statemtn...
as for info ...echo removes the double quotes..treating them as double quoted expression for echo command.....
I have a file in the format below with about 15 fields per each record. I have 2 records displayed below.
"1234","Andy ","Rich ","0001","123 Main Street ","Dallas ", "1"
"2345","Andrew ","Richter ","0002","234 First Ave ","Kirby ", " "
My Final output needs to be as follows
"1234","Andy","Rich","0001","123 Main Street","Dallas","1"
"2345","Andrew","Richter","0002","234 First Ave","Kirby"," "
I am using the following Sed command and it works excep it also deletes the space in the field and I need the last data element to stay like it is either a "1" or a " " (space).
sed -e 's/[ ]"/"/g' inputfile>outputfile...
what do I need to change in the sed command that I am using to get the result that I am looking for. The above is just the sample of the data, and it is not all data elements, there are quite a few additional fields but the last field is what I have in my data sample.