For given input file input containing the following:
domain demesne To filter for lines containing domain:
$ awk '/domain/ { print }' input domain To filter for lines not containing domain:
$ awk '!/domain/ {print }' input demesne For filtering based on the field rather than the entire line, we can try the following for the new given input file:
example www.example.com exemplar www.example.net To filter out lines where the first field is contains example:
$ awk '$1 !~ /!example/ { print }' input exemplar www.example.net In your question, you used $0 which is the entire line rather than the first field.