From: Bjoern Olausson (namdlist_at_googlemail.com)
Date: Thu Jul 28 2011 - 03:28:41 CDT

On Wednesday 27 July 2011 21:39:02 Erik Nordgren wrote:
> Sara -- on my linux machine, this command appears to work the way you
> want, if you just add the space:
>
> cat file.gro | sed "s/So/SA /g" > processed.gro
>
> But perhaps the version of that command that will work better for you
> will be as follows:
>
> cat file.gro | sed "s/So/SA\ /g" > processed.gro
>
> That is, use a backslash-space in order to include a literal space
> character within the argument to the sed program.
>
> Also, make sure that you are using the right kind of quotation
> marks... single quotes (') double quotes (") and back-quotes (`) all
> mean different things to the Unix shell!
>
> As for your desire to "sue" the stream editor, well, wouldn't we all
> like to do that sometimes.... ;-)
>
> -Erik
>

To make things easier and avoid uneccessary piping or escaping, use the
following command:

sed "s|So|Sa |g" file.gro > processed.gro

You do not have to escape the space.

If you want to modify the file in place, use:
sed "s|So|Sa |g" -i file.gro

Cheers,
Bjoern

-- 
Bjoern Olausson
Martin-Luther-Universität Halle-Wittenberg 
Fachbereich Biochemie/Biotechnologie
Kurt-Mothes-Str. 3
06120 Halle/Saale
Phone: +49-345-55-24942