Trying to find files that contains specific strings in name, but don't know how to sort output, in a way, that I will get file names only.
I've tried
OLDDATA=`find . -regex ".*/[0-9.]+" | ls -t`
But ls -t is not working on find result but on whole directory
edit: Result of this statement should be sorted by modification day directories. This regex suppose to match directories that contains only numbers and dots in name.
Best Answer
find
+sort
+cut
approach:%T@
- File's last modification time, where@
is seconds sinceJan. 1, 1970, 00:00 GMT,
with fractional part%f
- File's name with any leading directories removed (only the last element)To sort in descending order: