I have multiple wifi network ssid\'s saved in my etc/wpa_supplicant/wpa_supplicant.conf like shown below, can we delete a specific network from this wpa_supplicant.conf
SSID=$1
temp_var=$(sudo awk -v RS= '!/${SSID}/{printf $0""RT}' etc/wpa_supplicant/wpa_supplicant.conf)
echo -e "$temp_var" | sudo tee etc/wpa_supplicant/wpa_supplicant.conf
The temp var is needed because this is the easiest way I found to actually make awk write to he file its processing. To see the effect of changing wpa_supplicant.conf, do
svc wifi disable && svc wifi enable
Some references: