Hi balajesuri,
Thank you for providing a solution.
In this case can you explain why the question mark is needed in (?!Clear)
I understand that !Clear means do not match clear, but would like some clarification on ? preceding it.
Thanks.
--- Post updated at 02:51 PM ---
Dear balajesuri,
I have found the solution after checking further online, posting here for others to have a look.
(?!) is a regex construct known as negative lookahead.
example: match a q not followed by a u. Negative lookahead provides the solution: q(?!u). The negative lookahead construct is the pair of parentheses, with the opening parenthesis followed by a question mark and an exclamation point.
Reference:
Regex Tutorial - Lookahead and Lookbehind Zero-Length Assertions
However I just noticed the machine on which I need to execute this script does not support "grep -P." Can you help me out with an alternative solution? (sed/awk) is ok.
Thanks.