Page 1 of 1

Posted: Wed Oct 11, 2000 12:07 am
by admin
How about the DSExecute subroutine?




(is that less than 25 words?)

-----Original Message-----
From: Phil Walker [SMTP:philw@gnosys.co.nz]
Sent: Wednesday, October 11, 2000 6:45 AM
To: informix-datastage@oliver.com
Subject: sed

Sort of related.

I want to run a sed command to replace a tag e.g. HOMEDIRECTORY with a value which contains "/" how do I do it - in 25 words or less. For example

sed -e "s/HOMEDIRECTORY/${HOME}/g" -f file.txt > file.txt.1

Does anyone know how to do this?




*************************************************************************
This e-mail and any files transmitted with it may be confidential and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in
error, please notify the sender by return e-mail, and delete this e-mail from your in-box. Do not copy it to anybody else

*************************************************************************

Posted: Wed Oct 11, 2000 2:13 am
by admin
Hi Phil,

You need to change the "/" delimiter in the sed command

eg:

sed -e "s~HOMEDIR~${HOME}~g" file.txt

"~" seems to be a good substitute character for "/" in this case.

N.B.: drop the -f option, since this will make sed think that file.txt contains editing commands.



Regards,

Anthony

> -----Original Message-----
> From: David Barham [SMTP:David.Barham@anglocoal.com.au]
> Sent: Tuesday, October 10, 2000 2:07 PM
> To: informix-datastage@oliver.com
> Subject: RE: sed
>
> How about the DSExecute subroutine?
>
>
>
>
> (is that less than 25 words?)
>
> -----Original Message-----
> From: Phil Walker [SMTP:philw@gnosys.co.nz]
> Sent: Wednesday, October 11, 2000 6:45 AM
> To: informix-datastage@oliver.com
> Subject: sed
>
> Sort of related.
>
> I want to run a sed command to replace a tag e.g. HOMEDIRECTORY with a
> value which contains "/" how do I do it - in 25 words or less. For
> example
>
> sed -e "s/HOMEDIRECTORY/${HOME}/g" -f file.txt > file.txt.1
>
> Does anyone know how to do this?
>
>
>
>
> **********************************************************************
> ***
> This e-mail and any files transmitted with it may be confidential
> and are intended solely for the use of the individual or entity to
> whom they are addressed. If you have received this e-mail in
> error, please notify the sender by return e-mail, and delete this
> e-mail from your in-box. Do not copy it to anybody else
>
> **********************************************************************
> ***

Posted: Wed Oct 11, 2000 7:38 am
by admin
Can you "escape" the slash (for example / (backslash slash) in the sed script? For example: sed -e "s//usr/Ardent/uv/${HOME}/g" file.txt > file.txt.1 (Dont use the -f option unless file.txt contains editing commands.)

> ----------
> From: Phil Walker[SMTP:philw@gnosys.co.nz]
> Reply To: informix-datastage@oliver.com
> Sent: Tuesday, 10 October 2000 21:45
> To: informix-datastage@oliver.com
> Subject: sed
>
> Sort of related.
>
> I want to run a sed command to replace a tag e.g. HOMEDIRECTORY with a
> value which contains "/" how do I do it - in 25 words or less. For
> example
>
> sed -e "s/HOMEDIRECTORY/${HOME}/g" -f file.txt > file.txt.1
>
> Does anyone know how to do this?
>
>
>