How to I use awk to cut based on a word that keeps everything after it : Example:
File.txt >
XXXXWORDNNNNNN
XXXWORDNNNNNNN
XXWORDNNNNNNNN
XWORDNNNNNNNNN
WORDNNNNNNNNNN
output desired:
File.txt >
NNNNNN
NNNNNNN
NNNNNNNN
NNNNNNNNN
NNNNNNNNNN
1 Answer
cat File.txt | awk -F"WORD" '{ print $2 }'
The -F parameter usually searches for a single character as a delimiter, but since you wanted to use a string of letters as your delimiter, it must be put in double quotes.
The $2 means all the text following "WORD" ... unless "WORD" reoccurs in the line of text. If that happens then you'll only see the text in between the first and second occurrence of "WORD".
I hope this helps.