#!/bin/bash

# Get list of IP addresses and their corresponding interfaces
IP_ADDRESSES=$(ip addr show | grep 'inet 192.168' | awk '{print $2 " " $NF}')

# Loop through each line containing an IP address and interface
echo "$IP_ADDRESSES" | while read -r line; do
    # Extract IP address and interface
    ip=$(echo $line | awk '{print $1}')
    interface=$(echo $line | awk '{print $2}')

    # Delete the IP address
     ip addr del $ip dev $interface
    echo "Deleted IP $ip from interface $interface"
done
