I'm trying to do a compare between a config from an old box and a new box to verify Availability and State haven't changed.
I have a file that is generated with about a thousand nodes but every node has these lines (value is different). So my goal is when I run my compare/diff script I want to pull value for lines..
first line I just need Ltm::Node: (value between braces)
Availability (keep value after :)
State (keep value after :)
Reason (keep value after :)
Monitor (keep value after : but if exists do not include (default node monitor)
Monitor Status (keep value after :)
--------------------------------------------------
Ltm::Node: Development/10.47.63.133 (10.47.63.133)
--------------------------------------------------
Status
Availability : available
State : enabled
Reason : Node address is available
Monitor : /Common/icmp (default node monitor)
Monitor Status : up
Here is a few old
Ltm::Node: Common/splunk-hec1-p.mwg.com (::)
Availability : unavailable
State : enabled
Reason : No records returned
Monitor : /Common/icmp (default node monitor)
Monitor Status : fqdn-up-no-address
Ltm::Node: Common/_auto_10.72.7.122 (10.72.7.122)
Availability : unknown
State : enabled
Reason : Node address does not have service checking enabled
Monitor : Common/none
Monitor Status : unchecked
Ltm::Node: Common/_auto_10.72.12.148 (10.72.12.148)
Availability : unknown
State : enabled
Reason : Node address does not have service checking enabled
Monitor : Common/none
Monitor Status : unchecked
Here is a few new so you can see the differences (minor but difficult since compare shows difference in name)
Ltm::Node: splunk-hec1-p.mwg.com (::)
Availability : unavailable
State : enabled
Reason : No records returned
Monitor : /Common/icmp (default node monitor)
Monitor Status : fqdn-up-no-address
Ltm::Node: _auto_10.72.7.122 (10.72.7.122)
Availability : unknown
State : enabled
Reason : Node address does not have service checking enabled
Monitor : Common/none
Monitor Status : unchecked
Ltm::Node: _auto_10.72.12.148 (10.72.12.148)
Availability : unknown
State : enabled
Reason : Node address does not have service checking enabled
Monitor : Common/none
Monitor Status : unchecked
Why? migration from an old box to new box, the old box didn't follow any standard naming conventions and the new box does so the name Development/10.47.63.133 (or whatever it is) is almost a guarantee to be different.
I thought of exporting all info into a .txt file (which the above is a snippet from file) from legacy box and do the same thing on new box and run a script that does a diff to look for any differences. HOPE is to show what doesn't match so I can quickly attack and look for a solution.
someone suggested AWK.. I tried diff and that I can show all lines but I have over a thousand nodes and would take too long. Trying to use Ltm::Node: (10.47.63.133) as the index that will match between old and new and all the stuff underneath will be what is compared to see if anything doesn't match.
Sorry for the confusion.. wasn't sure how to describe this headache.