I am using sed to replace all lines in the txt file matching the selected patterns in each line
#make 2 substitutions with sed
sed 's|\/Volumes/Macintosh HD 2/Analys/output/CNE/RG/||; s|\.log||'
where I need to replace the path "/Volumes/Macintosh HD 2/Analys/output/CNE/RG/"
However, if I define the path into variable set in bash script
path_to_replace='/Volumes/Macintosh HD 2/Analys/output/CNE/RG/'
and then to use it with sed
sed 's|\"${path_to_replace}"||; s|\.log||'
sed do nothing. How the variable could be properly used with the sed function?
sed "s|${path_to_replace}||; s|\.log||"
– αғsнιη Oct 23 '20 at 13:11