find files that have number in file name greater than
You may use seq
for that, but it works only if all files have same naming convention:
seq -f "%02g-a.txt" 6 10
06-a.txt
07-a.txt
08-a.txt
09-a.txt
10-a.txt
I.e.:
cat `seq -f "%02g-a.txt" 6 10` > bigfile.txt
It will cat all files named as "< numeric_value >-< rest >" and having this < numeric_value > greater than $LIM
.
Even if they are written with one single digit (like 5), with two digits (like 05), or more...
And even if the < rest > are different among the files.
LIM=5
for file in $(ls);
do
number=$(echo $file | cut -f1 -d'-');
[ $number -gt $LIM ] && cat $file >> bigfile.txt;
done
Assuming the folder contains only these files.
This would list all files where the number is > 5
ls [0-9]* | awk -F '-' '{if ($1 > 5) print $0}'