Skip to content

Instantly share code, notes, and snippets.

@sarkrui
Last active August 26, 2022 08:22
Show Gist options
  • Save sarkrui/45e3dff21d5f962068485355693bfe42 to your computer and use it in GitHub Desktop.
Save sarkrui/45e3dff21d5f962068485355693bfe42 to your computer and use it in GitHub Desktop.
Convert IP-CIDR to Rule list
#! /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
@sarkrui
Copy link
Author

sarkrui commented Aug 26, 2022

chmod +x converter.sh && ./converter.sh AS45102.txt

will get AS45102.list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment