using rm *text* you can delete all files which have a certain string in them. How would I make it so that it removes every file except for the ones with the specific wildcard?
I have attempted to use other things I've found, such as:
find . -type f -print0 | xargs --null grep -Z -L 'text' | xargs --null rm
or
grep -r -L -Z 'text' . | xargs --null rm
but these do not work. Instead, they are deleting all files in a given directory.
How could I do this?