Andreas Berglund<andreas.berglund@home.se> writes:
> I have a problem with the following sed snippet
> sed -i s"|^\( *PATH="\)\(.*\)|\1$ADD:\2|" ~/profile-test
> I need soft quotes in order for $ADD to expand and I also need to
> math against one doublequote in the regexp in for $ADD to be put in
> the corrct place.
The double quote character within Shell's double quotes can be
escaped with a backslash (“\”):
sed -i "s|^\( *PATH=\"\)\(.*\)|\1${ADD}:\2|"
However, one is by no means forced to use just one kind of
quotes in Shell, so the following is also possible:
sed -i 's|^\( *PATH="\)\(.*\)|\1'"${ADD}"':\2|'
> Does anyone know how to do this?
The questions like this are much more likely to be answered by
the comp.unix.shell Usenet newsgroup folks. The newsgroup could
be accessed either using some sort of newsreader software (Gnus,
Alpine, SLRN, Icedove/Thunderbird, etc.), e. g.: