|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I have a problem, i'd like to replace the "."(point) with the / put i get the following error: sed: -e Ausdruck #1, Zeichen 6: unknown option to `s' There is the code. ======================================== #!/bin/sh TEMP="com.mycompany.app" echo "$TEMP" echo $TEMP | sed -e 's/.///g' ======================================== I'd like this result: com/mycompany/app Thanks in advance! Daniel |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
sorg.daniel@googlemail.com wrote:
> Hi, > > I have a problem, i'd like to replace the "."(point) with the / > put i get the following error: > sed: -e Ausdruck #1, Zeichen 6: unknown option to `s' > There is the code. > > ======================================== > #!/bin/sh > > TEMP="com.mycompany.app" > echo "$TEMP" > echo $TEMP | sed -e 's/.///g' echo $TEMP | sed -e 's/\./\//g' or echo $TEMP | sed -e 's:\.:/:g' > > ======================================== > I'd like this result: com/mycompany/app > > Thanks in advance! > > Daniel Bye, Jojo |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
sorg.daniel@googlemail.com wrote:
> > I have a problem, i'd like to replace the "."(point) with the / > put i get the following error: > sed: -e Ausdruck #1, Zeichen 6: unknown option to `s' > There is the code. > > ======================================== > #!/bin/sh > > TEMP="com.mycompany.app" > echo "$TEMP" > echo $TEMP | sed -e 's/.///g' > > ======================================== > I'd like this result: com/mycompany/app escape . and / with a \ sed -e 's/\./\//g' -- Best regards | Be nice to America or they'll bring democracy to Cyrus | your country. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On 4 Jan., 14:21, "Joachim Schmitz" <nospam.j...@schmitz-digital.de>
wrote: > sorg.dan...@googlemail.com wrote: > > Hi, > > > I have a problem, i'd like to replace the "."(point) with the / > > put i get the following error: > > sed: -e Ausdruck #1, Zeichen 6: unknown option to `s' > > There is the code. > > > ======================================== > > #!/bin/sh > > > TEMP="com.mycompany.app" > > echo "$TEMP" > > echo $TEMP | sed -e 's/.///g' > > echo $TEMP | sed -e 's/\./\//g' > or > echo $TEMP | sed -e 's:\.:/:g' > > > > > ======================================== > > I'd like this result: com/mycompany/app > > > Thanks in advance! > > > Daniel > > Bye, Jojo Thank you, that's it.. Regards, Daniel |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Fri, 4 Jan 2008 05:16:34 -0800 (PST), sorg.daniel@googlemail.com wrote:
> Hi, > > I have a problem, i'd like to replace the "."(point) with the / > put i get the following error: > sed: -e Ausdruck #1, Zeichen 6: unknown option to `s' > There is the code. > > ======================================== > #!/bin/sh > > TEMP="com.mycompany.app" > echo "$TEMP" > echo $TEMP | sed -e 's/.///g' > > ======================================== [...] printf '%s\n' "$TEMP" | tr . / See also: IFS=. set -f set -- $TEMP IFS=/ newTEMP="$*" (note that it works differently in Unix shells and in old Bourne shells, and that the Unix standard sh is not necessarily in /bin like on Solaris). -- Stephane |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On Jan 4, 9:16 pm, sorg.dan...@googlemail.com wrote:
> Hi, > > I have a problem, i'd like to replace the "."(point) with the / > put i get the following error: > sed: -e Ausdruck #1, Zeichen 6: unknown option to `s' > There is the code. > > ======================================== > #!/bin/sh > > TEMP="com.mycompany.app" > echo "$TEMP" > echo $TEMP | sed -e 's/.///g' > > ======================================== > I'd like this result: com/mycompany/app > > Thanks in advance! > > Daniel # echo $TEMP | tr "." "/" com/mycompany/app |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On Jan 4, 8:57 am, Stephane Chazelas <stephane_chaze...@yahoo.fr>
wrote: > On Fri, 4 Jan 2008 05:16:34 -0800 (PST), sorg.dan...@googlemail.com wrote: > > Hi, > > > I have a problem, i'd like to replace the "."(point) with the / > > put i get the following error: > > sed: -e Ausdruck #1, Zeichen 6: unknown option to `s' > > There is the code. > > > ======================================== > > #!/bin/sh > > > TEMP="com.mycompany.app" > > echo "$TEMP" > > echo $TEMP | sed -e 's/.///g' > > > ======================================== > > [...] > > printf '%s\n' "$TEMP" | tr . / > > See also: > > IFS=. > set -f > set -- $TEMP > IFS=/ > newTEMP="$*" > > (note that it works differently in Unix shells and in old Bourne > shells, and that the Unix standard sh is not necessarily in /bin > like on Solaris). > > -- > Stephane This works too: TEMP="com.mycompany.app" echo $TEMP | sed 's/\./\//g' |
|
![]() |
| Outils de la discussion | |
|
|