#!/bin/bash Cnt="Germany"; awk -v GG=$Cnt '{if(match($0,GG) != "0")AA="1";if(AA == "1"){if( length($2) != "0" )print substr($0,2) ;else AA="0"} }' /etc/pacman.d/mirrorlist.pacnew > /etc/pacman.d/mirrorlist.germany rankmirrors -n 6 /etc/pacman.d/mirrorlist.germany > /etc/pacman.d/mirrorlist rm /etc/pacman.d/mirrorlist.germany