Hei everyone!
I have this variable in shell containing paths separated by a space:
LINE="/path/to/manipulate1 /path/to/manipulate2"
I want to add additional path string in the beginning of the string and as well right after the space so that the variable will have the result something like this:
LINE="/additional/path1/to/path/to/manipulate1 /additional/path2/to/path/to/manipulate2"
I tried this one but only get the old paths
#!/bin/bash
LINE="/path/to/one /path/to/two"
NEW_PATH=`echo $LINE | sed "s/^\([^ ]\+\) \([^ ]\+\)/\/add1\1 \/add2\2/"`
echo "$NEW_PATH"
Any help appreciated Thanks in advance
path1in the first case andpath2in the second case? Or did you mean to add the same for both?