Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function IP_valide()
- {
- local ip=$1
- local stat=1
- if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
- OIFS=$IFS
- IFS='.'
- ip=($ip)
- IFS=$OIFS
- [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
- && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
- stat=$?
- fi
- return $stat
- }
- fichier="$1"
- while read -r line
- do
- IP_valide $line
- if [[ $? -ne 0 ]];then
- echo $line
- fi
- done < "$fichier"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement