I'd like to create a script that will run a command, parse the output for certain fields/words and then email that information to me if it meets simple criteria.
For example, when run, the command will output several lines. I'll need to grab the
Name: Test1
Type: Windows
Active: No
blah: blah
blah2: blah blah blah
Name: Test2
Type: Unix
Active: Yes
blah: blah
blah2: blah blah blah
Given the above, I want to check to see if it is Active, and if so, email me the names of all that match that criteria? What I am struggling with is telling the script to look at the first X lines, look for the one that says "Active", test for "No" and if so, email me the Name field.
Hope that is not confusing and appreciate the help.
Thanks!