Page 1 of 1

Shell script to parse subnet ranges

Posted: Fri Nov 06, 2020 3:37 pm
by hudatolah

Code: Select all

#!/bin/sh
#get_fresh_subnet.sh
#Purpose: Gets fresh list of subnet ranges from a TMS PHP file for ADDM scanning

#clear previous download:
/bin/rm -f get_filtered_subnets_for_ADDM.ph*
/bin/rm -f sort3
/bin/rm -f sorted
/bin/rm -f tmssubnet.csv
#get fresh file:
wget http://telecomportal/Tools/get_filtered_subnets_for_ADDM.php

#parse file for subnet entries only.
grep ":" get_filtered_subnets_for_ADDM.php | cut -d\> -f2 | cut -d: -f1 | tr -s '/' ',' |grep -Ev '^224|^225|^226|^227|^228|^229|^23' > tmssubnet.csv
#