[oclug] Re: sed problem
Kevin Everets
flynn at clarkhall.ca
Thu Apr 21 14:56:21 EDT 2005
On Thu, Apr 21, 2005 at 02:49:09PM -0400, Vytas Janusauskas wrote:
> Hi,
>
> I have a problem that I hope can be easily be solved. I have a bunch of
> files in which I wish to substitute the # character with the &
> character. So I build a script containing sed commands as shown below.
>
> sed -e 's/#/&/g M021D14.AML > A021D14.AML
> etc ....
You have to escape the "&" like so:
sed -e 's/#/\&/g' M021D14.AML > A021D14.AML
Or you could also use the "tr" command:
cat M021D14.AML | tr "#" "&" > A021D14.AML
Kevin.
More information about the OCLUG
mailing list