Construct path

Hi,

I need to construct the below path from the two available directory path,

O/P

/home/data/test/run/ht/WEB/HTML
/home/data/test/run/ht/WEB/JSP
/home/data/test/run/ht/WEB/CSS

Path:1
------

/home/data/test/run/

Path:2
------

/home/data/share/app/01/lang/ht/WEB/HTML
/home/data/share/app/01/lang/ht/WEB/JSP
/home/data/share/app/01/lang/ht/WEB/CSS

Copy the directory from '/ht' till the end directory and paste to '/home/data/test/run/'

Sorry, I'm not really getting the purpose of your request?
Is it this what you want?

cd /home/data/test/run
mkdir -p ht/WEB/{HTML,JSP,CSS}

No, i just want to populate a string using the path 1 and path 2 provided.

How about using sed:

$ echo "/home/data/share/app/01/lang/ht/WEB/HTML
/home/data/share/app/01/lang/ht/WEB/JSP
/home/data/share/app/01/lang/ht/WEB/CSS" | sed 's:^.*/lang/:/home/data/test/run/:'
/home/data/test/run/ht/WEB/HTML
/home/data/test/run/ht/WEB/JSP
/home/data/test/run/ht/WEB/CSS

Thanks. I have done it using below

s=/home/data/test/run
d=/home/data/test/run/ht/WEB/HTML/
o=`echo $d | grep -o "/ht.*"`
o="$s""$o"
echo "Directory path "$o

---------- Post updated at 11:02 AM ---------- Previous update was at 10:59 AM ----------

sed is not working for me. can you please post entire code?

Using BASH script:

#!/bin/bash

PATH="/home/data/share/app/01/lang/ht/WEB/HTML
/home/data/share/app/01/lang/ht/WEB/JSP
/home/data/share/app/01/lang/ht/WEB/CSS"

for p in $PATH
do
        echo ${p/*lang//home/data/test/run}
done