I use this bash script sed_no_ocr.sh which has no x property (i.e. ls -al sed_no_ocr.sh shows -rw-r--r--):
#! /bin/bash
file=$1
concatenation(){
echo "sed -i -r -e 's/($1) ($2)/\1\2/;p' $file"
sed -i -r -e 's/($1) ($2)/\1\2/;p' $file
}
concatenation "bypas" "sAfromALUinWB" $file
Input file E4.13.4_orig.v:
...
assign bypas sAfromALUinWB = (IDEXrs1 == MEMWBrd) && (IDEXrs1 != 0) &&
...
I use sed 4.9. But the script fails to change the input file when running . ../sed_no_ocr.sh E4.13.4_orig.v. Running sed -r -e 's/(bypas) (sAfromALUinWB)/\1\2/p' E4.13.4_orig.v in bash works.
Q: how to make above concatenation function works in the bash script?
') the variables$1... are not intrepretted – Romeo Ninov Jul 27 '23 at 05:14fileis$3– Romeo Ninov Jul 27 '23 at 05:15man bashsays "Enclosing characters in single quotes preserves the literal value of each character within the quotes", maybe I should avoid use single quotes as the default quotes. – An5Drama Jul 27 '23 at 05:46awk– Romeo Ninov Jul 27 '23 at 06:20$name) and command outputs ($(date)) you should use double quotes. – Chris Davies Jul 27 '23 at 08:40awkandsedare helpful to manipulate with texts 2. Sorry for saying too absolute. I will take care when choosing whether to use single quotes or double quotes. – An5Drama Jul 27 '23 at 11:48