Hi all
How to replace the
<x>
with word Before_last_dir only on the dir that located before the last dir (according to this example – dir4)
echo "/dir1/dir2/dir3<x>/dir4<x>/dir5<x>" |sed s"/<x>/Before_last_dir/g"
Another example
echo "/dirA<x>/dirB<x>/dirC<x> >" |sed s"/<x>/Before_last_dir/g"
should be
/dirA<x>/dirBBefore_last_dir/dirC<x>