|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi Gurus
I'm new to sed. How does one replace / with // for a string for example //filer/test/test2/test3/test4 to become ////filer//test/t/test2// test3//test4 ? I have tried a variety like TEMP_VAR=`/usr/bin/sed -e 's/\//K/g' //filer/test/test2/test3/test4 ` and I still can't get it right. I'm not sure how to escape /. Any is appreciated. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
zw wrote:
> Hi Gurus > > I'm new to sed. > How does one replace / with // for a string for example > //filer/test/test2/test3/test4 to become ////filer//test/t/test2// > test3//test4 ? Use another delimiter than the usual / in your sed call, e.g. a comma... sed 's,/,//,g' Janis > I have tried a variety like > TEMP_VAR=`/usr/bin/sed -e 's/\//K/g' //filer/test/test2/test3/test4 ` > and I still can't get it right. > I'm not sure how to escape /. > > Any is appreciated. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Mar 24, 4:59pm, Janis Papanagnou <Janis_Papanag...@hotmail.com>
wrote: > zw wrote: > > Hi Gurus > > > I'm new to sed. > > How does one replace / with // for a string for example > > //filer/test/test2/test3/test4 to become ////filer//test/t/test2// > > test3//test4 ? > > Use another delimiter than the usual / in your sed call, e.g. a comma... > > sed 's,/,//,g' > > Janis > > > > > I have tried a variety like > > TEMP_VAR=`/usr/bin/sed -e 's/\//K/g' //filer/test/test2/test3/test4 ` > > and I still can't get it right. > > I'm not sure how to escape /. > > > Any is appreciated.- Hide quoted text - > > - Show quoted text - Janis thanks for responding. I'ms till not getting what I want. I think it has to do with Ant task <shellscript> |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
zw <MPC8250@gmail.com> writes:
> Janis thanks for responding. I'ms till not getting what I want. > I think it has to do with Ant task <shellscript> Show input and desired output.... Thanks. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
zw wrote:
> > I'm new to sed. > [...] > I'm not sure how to escape /. with a \ -- Best regards | Monica Lewinsky's X-Boyfriend's Cyrus | Wife for President |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
zw wrote:
> Hi Gurus > > I'm new to sed. > How does one replace / with // for a string for example > //filer/test/test2/test3/test4 to become ////filer//test/t/test2// > test3//test4 ? $ echo '//filer/test/test2/test3/test4' | sed 's%/%//%g' ////filer//test//test2//test3//test4 or, much less readable $ echo '//filer/test/test2/test3/test4' | sed 's/\//\/\//g' ////filer//test//test2//test3//test4 You can use almost any character in place of the / to separate the expressions. -- All the commands are tested with bash and GNU tools, so they may use nonstandard features. I try to mention when something is nonstandard (if I'm aware of that), but I may miss something. Corrections are welcome. |
|
![]() |
| Outils de la discussion | |
|
|