Consider the following line of text (taken from a MySQL insert):
"description" varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
I want to return
"description" varchar(255) NOT NULL DEFAULT '',
I.e. I want to remove COLLATE utf8_unicode_ci
. However, the collation following the COLLATE
keyword can vary depending on the original Database schema.
I've come across lookaheads, but not quite sure how I could use it to remove the word.
awk '/COLLATE/ {$3=$4=""}1' file
...COLLATE
and the field immediately after it; isn't that what you were after?