#!/bin/bash
#Enter ./Extract_ip_addresses_from_txt.sh -f (the txt file you want to extract ip addresses from)
while getopts :f: FLAG; do case $FLAG in
f) # set filename and or path to desired txt file
FILENAME=$OPTARG
;;
\?) # unrecognized option - show help
echo "you are a tool"
exit 0
;;
esac
done
grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' $FILENAME>ip_address_list_from_$FILENAME.txt
cat ip_address_list_from_$FILENAME.txt