Last active
August 26, 2022 08:22
-
-
Save sarkrui/45e3dff21d5f962068485355693bfe42 to your computer and use it in GitHub Desktop.
Convert IP-CIDR to Rule list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
file=$1 | |
pre="IP-CIDR," | |
suff=",no-resolve" | |
ext="list" | |
name=`echo "$1" | cut -d'.' -f1` | |
release=${name}.${ext} | |
echo "Exporting to ${release}..." | |
while IFS= read -r line; do | |
line=${line%$'\r'} | |
echo "${pre}$line${suff}" >> $release | |
done <$file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chmod +x converter.sh && ./converter.sh AS45102.txt
will get AS45102.list.