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.