I have setup the docker container to run the model evaluation.
In bash how do I list all files in foo/ but sort the files by the least significant digit of their size so 2820 comes first and then 281771 and finally 2279. I want just the file names e.g., file1 otherfile lastfile.
In bash how do I list all files in foo/ but sort the files by the least significant digit of their size so 2820 comes first and then 281771 and finally 2279. I want just the file names e.g., file1 otherfile lastfile.
To list all files in the `foo/` directory sorted by the least significant digit of their sizes and output only the filenames, use the following command:
1 2 3 4 | for f in foo/*; do [ -f "$f" ] || continue printf "%d\t%s\n" $(($(stat -c %s "$f") % 10)) $(basename "$f") done | sort -n -k1 | cut -f2- |
I extracted the following code from that output:
1 2 3 4 | for f in foo/*; do [ -f "$f" ] || continue printf "%d\t%s\n" $(($(stat -c %s "$f") % 10)) $(basename "$f") done | sort -n -k1 | cut -f2- |
Running the following program:
1 2 3 4 | for f in foo/*; do [ -f "$f" ] || continue printf "%d\t%s\n" $(($(stat -c %s "$f") % 10)) $(basename "$f") done | sort -n -k1 | cut -f2- |
2
0
5
7
1
6
4
3
9
8
Resulting in output: 2 0 5 7 1 6 4 3 9 8
Testing if the previous output matches the regex 2.*0.*5.*7.*1.*6.*4.*3.*9.*8: True