- Messages
- 209
- Reactions
- 22
So, I had an assignment for one of my unix class, we've been working on regular expressions. It took me a while, and I finally found a solution for this problem, but I can't help feeling there must be a more elegant and efficient way to do this...
Problem statement:
Display the full file name (including the full path) and file size of all files whose name (excluding the path) is longer than 10 characters.
My ugly solution:
find / . -printf '%p::%s bytes\n' 2> /dev/null | rev | egrep '::[a-Z\.]{10,}' | rev
Any of you fellow computer people have a better way?
Problem statement:
Display the full file name (including the full path) and file size of all files whose name (excluding the path) is longer than 10 characters.
My ugly solution:
find / . -printf '%p::%s bytes\n' 2> /dev/null | rev | egrep '::[a-Z\.]{10,}' | rev
Any of you fellow computer people have a better way?