Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
How can I use find to find all files that have a .xls or .csv extension? I have seen a -regex option but I don't know how to use it.
This question came from our site for professional and enthusiast programmers.
Why not simply use this:
find -name "*.xls" -o -name "*.csv"
You don't need regex for this.
If you absolutely want to use regex simply use
find -regex ".*\.\(xls\|csv\)"
find . \( -name \*.xls -o -name \*.csv \) -print
find . -name \*.xls -o -name \*.csv -print
Required, but never shown
10 years, 7 months ago
5 years, 7 months ago