Code review comment for ~ghadi-rahme/ubuntu/+source/ppa-purge:ubuntu/devel

Revision history for this message
Ghadi Rahme (ghadi-rahme) wrote :

Hello Andreas,

Sure I will switch to use sed instead as there is no alternative to the -i option in mawk.
The only way to achieve the same behavior as the -i option in mawk would be to do something like:

awk '/^Components:/ {print; print "Enabled: no"; next}1' "$LIST" > $LIST.tmp && chmod --reference=$LIST $LIST.tmp && chown --reference=$LIST $LIST.tmp && mv $LIST.tmp $LIST

while with sed it would be:

sed -i '/^Components:/a\\Enabled: no' "$LIST"

which seems much less error prone to me.

« Back to merge proposal