#!/bin/bash
grep -oP '\b(?!(?:word1|word2)\b)\w+' <<< "Extract all words but word1 and word2."