I'm trying to replace all line which starts with say Replace_ME
. I used,
sed -i -e "s/^Replace_ME.*$/Replace_ME=${Replaced}/" "$filename"
Though it works well with Linux but on android it's completely clearing the $filename
file! for that reason I'm currently using,
sed -i "8i\Replace_ME=${Replaced}" "$filename"
sed -i "231i\Replace_ME=${Replaced}" "$filename"
which is very inefficient as you can see. Is there any alternative way of replacing line starting with keyword other than sed say awk? But at the same time compatible with android? Thanks for reading this.