inserting data into an existing file
Situation,
I need to make sure that 7 lines of code exist in every instance of snmpd.conf in our network. I do not want to overwite the files as some customers have added special things to this file for their own monitoring. On top of that I don't want to just willy nilly append the 7 lines in case the data already exists in the file. I need to check the file first for the existence of this code, if so leave it alone if it doesn't exist then it needs to be appended to the file. any thoughts are welcome. |
Definitely a proper program needed in that case.
I'd recommend Perl, easy to write, fast running and has modules avail for dealing with networking, snmp etc. In fact, that's exactly the sort of thing it was originally designed to handle, way back when. See: http://perldoc.perl.org/ http://search.cpan.org/ and ask in prog forum, or www.perlmonks.org |
Yep, could get ugly. Lines exist, but out of order, or commented out, or have (variable) embedded whitespace, ...
erghh. Pick a (any ???) language you already know. Perl would work well, but has a fair learning curve (guess how I know ... :p ) |
All times are GMT -5. The time now is 07:31 AM. |