I have many txt files, named like file1.txt file2.txt file3.txt ... file1000.txt
How can I delete all these files? I am new to unix and concerned about accidentally deleting other files in my directory.
I've looked at other questions but I'm unsure, could I do something like
rm -v !("differentfile"|"anotherfile"|"otherfile"|"finalfile")
and therefore delete all my files with the same name and just different numbers and keep the few I want? And this line should only delete files in my working directory/folder correct?
Is there a way to use rm but only specific the files I want to delete all at once?
man 7 regex