BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: {bb} {BB} OT: sed problem..



You can try use...

session_reg=`echo  $session | sed -e 's#\/#\\\/#g'`

less slash to worry about and i did a short try and it worked.

-----
[tcadm@hera /]$ echo $session
2006/23/12
[tcadm@hera /]$ echo  $session | sed -e 's/\//\\\//g'
2006\/23\/12
[tcadm@hera /]$ echo  $session | sed -e 's#\/#\\\/#g'
2006\/23\/12
[tcadm@hera /]$ session_reg=`echo  $session | sed -e 's#\/#\\\/#g'`
[tcadm@hera /]$ echo $session_reg
2006\/23\/12


======================

> Hi brothers,
> 
> With all the script guru's here I thought maybe one of you might be able 
> to help out with a weird problem. I'm trying to escape the slashes in a 
> date so I can use it in another search and replace. however it dos work 
> from a normal command prompt, but not in a subshell:
> 
> noob$ echo $session
> 2006/23/12
> noob$ echo  $session | sed -e 's/\//\\\//g'
> 2006\/23\/12
> noob$ session_reg=`echo  $session | sed -e 's/\//\\\//g'`
> sed: Function s/\//\\//g cannot be parsed.
> 
> in the end I like to use ${session_reg} in the following line:
> cat backup.log | sed -e "s/${session_reg}/<A 
> href=\"${session_html}.html\">${session_reg}<\/a>/" > backup.html
> 
> 
> the ${session_html} is created with the following ilne (and works..):
> session_html=`echo $session | sed -e 's/\//_/g'`
> 
> Greetings,
> /Frank.
> --


--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.


Home | Main Index | Thread Index