ArchLinux: Activate mirrors of a country

When updating the mirrorlist all servers are commented out.

To update the list to habe the first eight servers of „Germany“ activated I use the following awk script:

#!/bin/sh

mv /etc/pacman.d/mirrorlist /etc/pacman.d/_mirrorlist ; cat /etc/pacman.d/_mirrorlist | awk '/^## Germany/ { inCountry = 1; counter = 0 } /^$/ { inCountry = 0; counter = 0 } /(^#Server =.*)/ { if (inCountry && (counter < 8)) { $0 = substr($0, 2); counter ++ } } { print } ' > /etc/pacman.d/mirrorlist