| # This program will modify a file by substituting all instances of a specified |
| # IP with "DUMMYIP". This is useful for making the IP address generic and thus |
| # Description of argument(s): |
| # file_path The path to a file which is to be modified. |
| if [ -z "${ip_addr}" ] ; then |
| echo "**ERROR** You must provide an IP address as the first positional" \ |
| if [ -z "${file_path}" ] ; then |
| echo "**ERROR** You must provide a file path as the second positional" \ |
| ip_addr_regex=`echo ${ip_addr} | sed 's/\(\.\)/\\\./g'` |
| sed -i 's/'${ip_addr_regex}'/DUMMYIP/g' ${file_path} |