I am trying to find a clever way to figure out if the file passed to sed has been altered successfully or not.
Basically, I want to know if the file has been changed
In macos I just do it as follows:
changes="" changes+=$(sed -i '' "s/$to_replace/$replacement/g w /dev/stdout" "$f") if [ "$changes" != "" ]; then echo "CHANGED!" fi
I checked, and this is faster than md5, cksum and sha comparisons
md5
cksum
sha