How to create many ifcfg-ethN files in one shot
I had a quick task to create 254 ifcfg-eth1:N configuration files for a Linux installation and certainly spending the whole day doing that manually wasn’t part of my plan. Here is a quick and dirty one-liner I used for that:
# for f in `seq 2 254`; do cat ifcfg-eth1 | \ sed -e 's/DEVICE=.*$/DEVICE=eth1\:'$f'/' \ -e 's/IPADDR=.*$/IPADDR=173.xxx.xx.'$f'/' \ -e 's/ONBOOT=.*$/ONPARENT=yes/' > ifcfg-eth1\:$f; done