Sed is line-oriented. It deals with single lines. That has never changed, and attempts to hack around it can be brittle, as you've discovered.
What will have changed is your input /etc/pacman.conf file - it'll now have an odd number of lines before the multilib one, and thus the N hack fails (because that relies on the correct lines being paired up).
So, instead of using Sed, why not solve this with an actual
patch?
First copy the file to (e.g.) /etc/pacman.conf.custom and modify as desired, then use
diff -u to create the patch:
Code:
diff -u /etc/pacman.conf /etc/pacman.conf.custom > ~/mypatches/pacman.conf.patch
Then to apply it:
Code:
patch --backup /etc/pacman.conf ~/mypatches/pacman.conf.patch
That process is scalable if there are other changes you might want to make, without needing to worry about multi-line handling or escaping certain characters.
(One can also use "
git diff" and "
git apply", without needing a Git repository; or indeed one can
version /etc using Git if desired.)