globalsec23 has asked for the wisdom of the Perl Monks concerning the following question:
I have a program i'm working on that basically will automate a virtual machine post install + extending an lvm
i've got the code for the extending all working
now my clone server that will run this program has an ip and FQDN that i need to change
the program usage is as follows:
Usage: ./update-vm -i <IP_ADDRESS> -s <SERVER_NAME> -i [IP_ADDRESS] IP Address to change to, format: A.B.C.D -s [SERVER_NAME] Hostname to change to, format: foo.foo.com or f +oo.foo.foo.foo.com -h Show this text
i was trying to avoid using system or just one liner perl search/replaces for the IP and hostname strings to search for in /etc/ and change
my variables are $old_ip statically set in program, $old_name statically set in program, $new_ip gotten from ARGV and $new_name gotten from ARGV
I did read about Find::File and Find::Glob and File::Slurp but i cant find any really good examples that dont just try and do find or system calls which i would like to avoid for best practice reasons, plus the examples ive seen are calling from a file where im grabbing from user input from my Getops::Long
thanks in advance for your help monks!
if i can provide anymore information ill be happy to!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: need to be able to search/replace by ip and hostname recursively in /etc based off ARG input
by arkturuz (Curate) on Jul 25, 2013 at 09:39 UTC | |
by globalsec23 (Initiate) on Jul 25, 2013 at 15:58 UTC | |
by arkturuz (Curate) on Jul 25, 2013 at 16:17 UTC |