Hi,
I have a repetitive regular expression that I am matching and I am performing the same action over and over.
I don't really want to write out the code every time for each word I want to match. I was wondering if anyone had a tip to reduce code duplication.
Here's a sample of the awk code I am using: -
I'm matching the keyword and putting a newline before it and forcing the keyword to uppercase. Basically I have to do this for a long list of keywords.
Any help would be appreciated
Thanks
I have a repetitive regular expression that I am matching and I am performing the same action over and over.
I don't really want to write out the code every time for each word I want to match. I was wondering if anyone had a tip to reduce code duplication.
Here's a sample of the awk code I am using: -
Code:
/[[:graph:]]+[[:space:]]*\<[red]keyword[/red]\>/ {
gsub(/\<[red]keyword[/red]\>/, "\n" [red]"KEYWORD"[/red])
}
I'm matching the keyword and putting a newline before it and forcing the keyword to uppercase. Basically I have to do this for a long list of keywords.
Any help would be appreciated
Thanks