Better way:
It will directly replace the first line only which begin by "dtoverlay=" with "dtoverlay=test" (the new i2s device).
Code:
sed '0,/^dtoverlay=/s/.*dtoverlay=.*/dtoverlay=test/' /boot/config.txt
It will directly replace the first line only which begin by "dtoverlay=" with "dtoverlay=test" (the new i2s device).