I'm looking for a UNIX command or set of commands, by which I can find the 20 largest files in a directory, based on a specific date range.
To do this I thought I could set the date range by touching a couple of files and then doing a find based on those file dates. i.e.
touch /tmp/point.start -d "2018-06-01 00:00" touch /tmp/point.end -d "2018-06-30 00:00"
and then run
find . -newer /tmp/point.start ! -newer /tmp/point.end
And to get the lagest 20 files I intended to run, from the directory,
ls -ltr | sort -nk5 | tail -20
But what I can't seem to do is combine the two
find . -newer /tmp/point.start ! -newer /tmp/point.end | ls -ltr | sort -nk5 | tail -20
simply ignores the first part and lists the 20 largest files in the directory regardless of size. I'm sure it's something very obvious I'm missing, but I can't figure out what!
(I'm on RedHat 5.3, and don't have access to newermt)