Afficher un message
Vieux 07/11/2006, 15h15   #2
Ed Morton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Bourne String Substitution Question

kk_oop@yahoo.com wrote:
> Hi. I'm writing a Bourne shell script. If I have these file path
> strings:
>
> root1="dir1/dir2/"
>
> root2="dir3/dir4/"
>
> I want to be able to take a path under root1 and make a string that
> points to the same path under root2. For example:
>
> Given "dir1/dir2/dirA/dirB", I'd like to change this to
> "dir3/dir4/dirA/dirB".


echo "dir1/dir2/dirA/dirB" | sed "s?$root1?$root2?"

Ed.
  Réponse avec citation
 
Page generated in 0,06286 seconds with 9 queries