New to sed and may use some help. I would like to include this "a / b / ca / b / c" in this "a / b / c abc". where a / b / c is any path.
thanks
Try:
sed 'h; s/ .*//; x; s/.* //; s:/:-:g; x; G; s/\n/ /'
Since you want to use spaces for deletion, I would just use perl:
perl -ane '$F[1] =~ s/\//-/; print "@F\n"'
you can use awk,
$ echo "a/b/c a/b/c" | awk '{gsub("/","-",$NF)}1' a/b/c a-b-c
This might work:
echo "a/b/c a/b/c" | sed ':a;s|\(.* [^/]*\)/|\1-|;ta' a/b/c a-b-c
Or that:
echo "a/b/c a/b/c" | sed 's/.* //;h;y/\//-/;x;G;y/\n/ /' a/b/c a-b-c