Line 2 above is building up variable A with your file contents, it does this by appending A with a newline plus the current line's contents for every line of the file.
As for Line 1: function procDNS always returns blank, this is just a small trick that allows us to process the contents of A and then reset A back to the empty string. This could have been written as:
You might prefer the above version for clarity. If you look at your datafile you will note that it starts with an "outgoing update" line. As no other lines have been read yet A will still be blank, procDNS needs to deal with blank input and not output a blank result, that is what the first line of the function is doing with the split command. Another elegant way to deal with this is to test for no updt_line as I guess output without this info is pretty meaningless:
Now remember the input to procDNS is the whole block between the "Outgoing update" lines. Your assessment of getfield() is pretty well spot on, note the value 16 above is the number of characters to discard from the front of the matched string. i.e. "UPDATE SECTION:" plus newline, which leaves the data required. You can easily extract other info you may need from the block using this technique.
See above how you can add further human readable versions of the error codes returned, I don't know what ones you actually see in the "wild", of course any fail codes not replaced will remain as they are eg "FORMERR", "BADVERS", "NOTZONE", etc.
Finally when you reach the end of the file A will have the last record built up in it but there is no "Outgoing update" line to trigger it's processing, so we call procDNS(A) in the END section (a blank file could will result in a blank block being sent to procDNS but we already know procDNS deals with this fine).
This User Gave Thanks to Chubler_XL For This Post:
I have a file that contains the output of the ls -iR command, something like this:
./results:
2504641011 result_1410 2500957642 result_525
2504641012 result_1425 2500957643 result_540
./tests/1:
2500788755 1 2500788743 1000
./tests/2:
2500788759 3 2500788758 999
... (6 Replies)
I need to parse the following out put and determine if the USB is a DISK and whether or not it's External.
If an HBA line contains "USB" then does the next line contain
"DISK" and "External".
0:0,31,0: HBA : (aacraid,1) AAC SCSI
0,0,0: DISK : Adaptec ASR4800SAS Volu0001
... (6 Replies)
Hello all,
I am new to Unix.. i am trying to implement the TSIG in my BIND and using nsupdate to add record to bind..
this is what i did:
generate the TSIG key using : dnssec-keygen HMAC-MD5 -b 128 -n HOST mydns.com
forgot to mention: i am using FreeBSD.
I then edit the named.conf file... (0 Replies)
Hello all,
I am new to Unix.. i am trying to implement the TSIG in my BIND and using nsupdate to add record to bind..
this is what i did:
generate the TSIG key using : dnssec-keygen HMAC-MD5 -b 128 -n HOST mydns.com
forgot to mention: i am using FreeBSD.
I then edit the named.conf file... (0 Replies)
Hello all,
I am new to Unix.. i am trying to implement the TSIG in my BIND and using nsupdate to add record to bind..
this is what i did:
generate the TSIG key using : dnssec-keygen HMAC-MD5 -b 128 -n HOST mydns.com
forgot to mention: i am using FreeBSD.
I then edit the named.conf file... (1 Reply)
Hi fellows,
I need to define a notification for SSL certificate expiration.
My Command output is below: (this is the "Expiration Date")
Tue Mar 15 09:30:01 2012
So, at 15th Feb (1 month before the expiration), a notification has to be triggered by a script or sth else. How can i set an... (5 Replies)
i have a log file that contains something similar to this:
one two three four five six seven eight
nine ten eleven twelve thirteen fourteen
one two three four five six seven eight
nine ten eleven twelve thirteen fourteen
one two three four five six seven eight
nine ten eleven twelve... (3 Replies)
Hi ,
i am trying to set up an alert, when CPU usage (0.2%us in below output) is more than 40%
top | head | grep '^Cpu'
Cpu(s): 0.2%us, 0.2%sy, 0.0%ni, 99.1%id, 0.6%wa, 0.0%hi, 0.0%si, 0.0%st
using CUT, i pulled the value 0.2 and assigned to CPU (variable)
CPU=$(expr `top | head -10... (5 Replies)