I am trying to change a single line of a special file whose comment character is ! to show a path to the file in the comment. such as:
!!HFSS and mcm path: \Signal_Integrity\Package_SI\Section_Models\C4toTrace\28nm\D6HS\SLC_5-2-5\GZ41_ICZ\NSSS\
to a different path and replace the !!HFSS and mcm path: text.
here is my code:
path='!! HFSS and mcm path: '$(pwd)
for file in $(find . -name "*s[48]p*")
do
old=$(grep '!! HFSS\|!!HFSS' $file)
sed -i "s@$old@$path@" $file
done
I get the following error for some but not all files!
sed: -e expression #1, char 260: Invalid back reference
can someone please help explain why it works for some files but not others?
Thanks,
Mike