In Bash, I want to get the Nth word of a string after a matching pattern with awk.
Example text:
hadf asdfi daf PATTERN asdf dsjk PRINT_THIS asdf adas
asdf sdf PATTERN asdf dasdf PRINT_THIS ads asdf PATTERN ads da PRINT_THIS
ads PATTERN ads da PRINT_THIS
Excepted output:
PRINT_THIS
PRINT_THIS
PRINT_THIS
PRINT_THIS
So if a pattern is found, the second word after the match should be output.
How can i do this?