Hi All,
I have a parameter as below
make_target_dir_name="/buildanddeploy/BUILDS/build.22/db/Db-1.17.9/SQL"
Now after writting sed I want only the output should display SQL by ripping /buildanddeploy/BUILDS/build.22/db/Db-1.17.9/ out from the input make_target_dir_name
my sed is not working
echo $make_target_dir_name | sed "s_.*Db-*[0-9]\+__")
--> Not working showing me
.17.9/SQL
How can I achieve this? this should dynamically take all the numbers out and show me only folders after the number.
why sed ?
echo $make_target_dir_name | awk -F/ '{print $NF}'
give
SQL
thanks ...but I can't rely on this
because my make_target_dir_name can have multiple subfolders and file names underneath.
e.g.
/buildanddeploy/BUILDS/build.22/db/Db-1.17.9/SQL/v1.16/db.changelog-update-v1.16.xml
in this case I want only
SQL/v1.16/db.changelog-update-v1.16.xml
Hence I want to display the string after the Number, this number is not static after every release the number will change.
try:
echo $make_target_dir_name | sed -n s'/\(.*Db-[0-9]\.[0-9][0-9]\.[0-9]\/\)\(.*\)/\2/p;'
thanks
from this I made little dynamic way to serve my purpose
echo $make_target_dir_name | sed -n s"/\(.*Db-[0-9]\+\.[0-9]\+\.[0-9]\+\/\)\(.*\)/\2/p;"