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.
1 | ls -1 foo/ | sort -n -t . -k 1.10 | awk '{print $NF}' |
1 2 3 | file1 2820 otherfile 281771 lastfile 2279 |
1 2 3 | file1 otherfile lastfile |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 9 10 | #!/bin/bash # List all files in the foo/ directory, one per line ls -1 foo/ | # Sort the files numerically based on the least significant digit of their size sort -n -t . -k 1.10 | # Print only the filename (the last field) of each line awk '{print $NF}' |
Running the following program:
1 2 3 4 5 6 7 8 9 10 | #!/bin/bash # List all files in the foo/ directory, one per line ls -1 foo/ | # Sort the files numerically based on the least significant digit of their size sort -n -t . -k 1.10 | # Print only the filename (the last field) of each line awk '{print $NF}' |
0
1
2
3
4
5
6
7
8
9
Resulting in output: 0 1 2 3 4 5 6 7 8 9
Testing if the previous output matches the regex 2.*0.*5.*7.*1.*6.*4.*3.*9.*8
: False
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.
1 | ls -Srt foo/ | cut -d ' ' -f9- |
I extracted the following code from that output:
1 | ls -Srt foo/ | cut -d ' ' -f9- |
Running the following program:
1 | ls -Srt foo/ | cut -d ' ' -f9- |
9
8
7
6
5
4
3
2
1
0
Resulting in output: 9 8 7 6 5 4 3 2 1 0
Testing if the previous output matches the regex 2.*0.*5.*7.*1.*6.*4.*3.*9.*8
: False
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.
1 | ls -l foo/ | awk '{print $9}' | sort -n -t . -k 2 | awk 'NR%10==1' |
I extracted the following code from that output:
1 | ls -l foo/ | awk '{print $9}' | sort -n -t . -k 2 | awk 'NR%10==1' |
Running the following program:
1 | ls -l foo/ | awk '{print $9}' | sort -n -t . -k 2 | awk 'NR%10==1' |
9
Resulting in output: 9
Testing if the previous output matches the regex 2.*0.*5.*7.*1.*6.*4.*3.*9.*8
: False