I am writing a script that requires me to provide a list of files in my directory, whose filenames contain spaces,*,?,$,%,etc. How can I do this, I have seen multiple posts but couldn't find anything that works for me. Is it possible to achieve this using grep?
How to list filenames that contain spaces and special characters without using find
bash;command line;wildcards
grep -E should do what you need. Note that some characters need to be escaped with a backslash, so if you add more and the results aren't what you expected, escape it and try again. Note the | is an or...$ ls | grep -E '\s|\*|\?|\$|%'all this.txtall?this.txtall*this.txtall%this.txtall th*s.txtall$.txt