Jay Hannah is a user on octodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.

Tee-hee! Thanks to Walt for his annual reminder how awesome one-liners are!

youtube.com/watch?v=IGe0GnlIWq

My use today (squash HUGE IP list into CIDR blocks):

perl -MNet::CIDR::Lite -ne 'BEGIN{$cidr = Net::CIDR::Lite->new} s/[\r\n]+$//; $cidr->add_ip($_); END{print join "\r\n", $cidr->list; print "\r\n"}' IPs.txt
3.183.14.16/32
3.233.163.76/32
...

Jay Hannah @deafferret

Cleaner if Unix (or using -l):

perl -MNet::CIDR::Lite -lnE 'BEGIN{$cidr = Net::CIDR::Lite->new} $cidr->add_ip($_); END{say join "\n", $cidr->list}' IP.txt | head
3.183.14.16/32
3.233.163.76/32
...

· Web · 0 · 0