the string IP include some IP address numbersas the following exampleecho ${IP[*]}192.9.200.1 192.9.200.2 192.9.200.3is it possible to remove some IP address number from the list ( using ksh shell ) ?for exampleI want to delete the IP - 192.9.200.2 from the string IPso I will get the followingecho ${IP[*]}192.9.200.1 192.9.200.3
ksh + delete number from string
linux;shell script;perl;ksh
IP=(192.9.200.1 192.9.200.2 192.9.200.3)remove=192.9.200.2new=()for ip in ${IP[@]}; do [[ $ip != $remove ]] && new+=($ip); doneecho ${new[*]}192.9.200.1 192.9.200.3Orfor ((i=0; i<${#IP[@]}; i++)); do    [[ ${IP[i]} == $remove ]] && unset IP[i]doneecho ${IP[*]}                                                                 192.9.200.1 192.9.200.3