I just want to get the files from the current dir and only output .mp4 .mp3 .exe files nothing else. So I thought I could just do this:
ls | grep \\.mp4$ | g
Why not:
ls *.{mp3,exe,mp4}
I'm not sure where I learned it - but I've been using this.
ls -R | findstr ".mp3"
ls -R
=> lists subdirectories recursively
egrep
-- extended grep -- will help here
ls | egrep '\.mp4$|\.mp3$|\.exe$'
should do the job.
In case you are still looking for an alternate solution:
ls | grep -i -e '\\.tcl$' -e '\\.exe$' -e '\\.mp4$'
Feel free to add more -e flags if needed.
the easiest way is to just use ls
ls *.mp4 *.mp3 *.exe
For OSX users:
If you use ls *.{mp3,exe,mp4}
, it will throw an error if one of those extensions has no results.
Using ls *.(mp3|exe|mp4)
will return all files matching those extensions, even if one of the extensions had 0 results.