The Excentis Cable Modem Config File Editor can also be used as a command-line tool, using the standard java JRE.

The CommandLine tool functionality allows easy integration in scripts. See the Excentis Cable Modem Config File Editor Manual for more details!

The following bash script illustrates how to use the CommandLine tool to change a line of text in a batch of configfiles, automatically recalculating CM and CMTS mics.

#!/bin/bash
# Input vars:
# directory containing the config files
cfg_dir=/home/vandeynse/configfiles
# directory containing Excentis Cable Modem Config File Editor install
cfg_jar_path=/home/vandeynse/Excentis/ConfigFileEditor/jar/coupe.jar
main_class=com.excentis.configfile.CommandLine
# shared secret
shared_secret=Euro
# temp text file
temp_text_file=/tmp/configfile.txt
# actual script
# loop over all .cfg files
for cfgfile in `ls -a $cfg_dir/*.cfg`
do
echo “$cfgfile”
# create textual version, using the bin2text function
`java -classpath $cfg_jar_path $main_class bin2text $cfgfile $temp_text_file`
# use regexp to change the configfile
# example: reduce max cpe from 16 to 8
sed -i -e ‘s/Maximum Number of CPEs:16/Maximum Number of CPEs:8/g’ $temp_text_file
# overwrite the file with the updated contents, using the text2bin function
`java -classpath $cfg_jar_path $main_class text2bin $temp_text_file $cfgfile $shared_secret`
# clean up temp file
rm $temp_text_file
done