Ghostdog,
Thanks for the great code example! I am mostly there. Here's what my sample data actually looks like (yes, each Policy entry will have the ---- as a separator):
------------------------------------------------------------
Policy Name: _suspended
Policy Type: Standard
Active: no
Effective date: 08/13/2007 17:08:18
More lines
And here's my script right now:
awk 'BEGIN{FS="[: ]"}
/Name/{ name=$1 }
/Active/ && /no/{
print name " is NOT active!" }
' /tmp/policy.txt
I had to change the name variable to $1 otherwise it wouldn't show anything. The script is working, but the output is not just the deactivated policy name, it's the whole line. From the example above it would output:
Policy Name: _suspended is NOT active!
I can't figure out how to get the "Policy Name:" and all the whitespace removed from the output. I thought that was what the separator did? I tried changing that to \t, [: ], but that still didn't do anything. Ideas?