Using the CommandLine tool to change a batch of config files
Posted by David Van Deynse, Last modified by Dries Decock on 03 April 2018 05:28 PM

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.


# Input vars:
# directory containing the config files
# directory containing Excentis Cable Modem Config File Editor install
# shared secret
# temp text file

# actual script
# loop over all .cfg files
for cfgfile in `ls -a $cfg_dir/*.cfg`
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

(1 vote(s))
Not helpful

Comments (0)

We to help you!