I have a file that looks something like this:
Volume1 created=Monday blah blah foo foo lock mode=exclusive ops layer id=1 Volume2 created=Tuesday jibber jabber foo foo ops layer id=2 Volume3 created=Wednesday blaaah foooo lock mode=shared ops layer id=3
What I'd like to do is grep on "lock mode" and if that is there print that whole line, otherwise I'd like to print "NA". I can't seem to figure out how to print something for non-matching lines. I'm sure awk or sed could do this as well.
I've been trying code similar to:
grep -A6 Volume | grep "lock mode" <file>
I'd like the output to show the following, for this example:
lock mode=exclusive NA lock mode=shared