Hi,
I have a problem when doing some pattern matching.
Basically I'm trying to insert a new line whenever I come across a certain word i.e. WORD. But if the text is enclosed in some brackets for example, then I want to leave it as it is.
At the moment I am applying the pattern to WORD when it is found but I am ignoring anything in brackets by skipping to the next line. This approach doesn't work if I have the following text - "(Some text with WORD) and WORD". Because the line is skipped as it has brackets.
I'm sure theres a simple way of doing this but I'm new to awk so I'm struggling. By the way I am using gawk on windows. Any help would be appreciated.
I have a problem when doing some pattern matching.
Basically I'm trying to insert a new line whenever I come across a certain word i.e. WORD. But if the text is enclosed in some brackets for example, then I want to leave it as it is.
At the moment I am applying the pattern to WORD when it is found but I am ignoring anything in brackets by skipping to the next line. This approach doesn't work if I have the following text - "(Some text with WORD) and WORD". Because the line is skipped as it has brackets.
I'm sure theres a simple way of doing this but I'm new to awk so I'm struggling. By the way I am using gawk on windows. Any help would be appreciated.