Reputation: 175
How to display all files with specific extensions. For example, I have a1.cpp, b2.cpp, c3.py, d4.py. How to display cpp only with numbers.
1. a1.cpp
2. a2.cpp
Upvotes: 1
Views: 52
Reputation: 92854
How to display cpp only with numbers
Use find command:
find -type f -name "*[0-9].cpp"
If "with numbers" you meant not numbers within filenames, but the incremental numbers of outputted items/files - find + nl pipeline:
find -type f -name "*.cpp" | nl -nln -s'. ' -w1
Upvotes: 3