The recent thread on CIDR aggregation cleanup scripts reminds me that I'm looking for a similarly efficient implementation of a related tool. (I'm gearing up to write my own in Perl, but don't want to reinvent the wheel.)
I'd like a fast, Unix-pipeline-ready tool that *replaces* all IPs within that range with a supplied string, using a simple config file as input, and ideally with autodetection of IP-address "word" boundaries, as in:
$ cat cidr-replace.cfg
$ echo "source,data1,data2,209.112.130.2,data3" | cidr-replace cidr-replace.cfg
source,data1,data2,[ACS],data3
And I know this is kludgy, but it would also be useful for quick-and-dirty work if it had a flag to "append" the string using a known delimiter, as in:
$ echo "source,data1,data2,209.112.130.2,data3" | cidr-replace --append ',' cidr-replace.cfg
source,data1,data2,209.112.130.2,[ACS],data3
(But I'm happy to hack that last functionality into an existing script.)
--