Reputation: 1141
I'm trying to do a search/replace with sed
for inserting a file path into a string on an Ubuntu OS.
Example of Line to Search/Replace:
arc1.4x_os
Attempted Sed Code:
blendpath="/home/weather/data/arc/"
sed "s/^arc1.4x_os/'\''open '${blendpath}'arc1.4x_os/g"
Expected Output:
'open /home/weather/data/arc/arc1.4x_os
Terminal Error Message:
sed: -e expression #1, char 20: unknown option to `s'
Upvotes: 2
Views: 445
Reputation: 133710
Following sed
may help you on same.
echo "arc1.4x_os" | sed "s|arc1.4x_os|'open /home/weather/data/arc/&|"
I am using above echo
for printing the variable for example you could use following sed
for an Input_file too.
sed "s|arc1.4x_os|'open /home/weather/data/arc/&|" Input_file
Upvotes: 2