0

I am trying to filter my output to display only files created in "Jan" and "Feb". Is there a way to do this without using grep?

Would need to be able to switch from "Jan" and "Feb" to "Jan" and "Mar" etc..

Avoxy
  • 79
  • 2
  • 7

2 Answers2

2

Try this :

find . -newermt "31 Dec 2017" -not -newermt "28 Feb 2018"

or for your specific need:

find . -newermt "31 Dec 2017" -not -newermt "28 Feb 2018" -size +30M -printf '%s %p\n' | numfmt --to=iec | sort -h

or if you want to keep your command :

find . -newermt "31 Dec 2017" -not -newermt "28 Feb 2018" -size +30M -print0 |
xargs -0 ls -lh | sort -h 

Check :

man find | less +/'-newerXY reference' 
Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223
0
touch -d 1/1/2018 jan
touch -d 3/1/2018 mar
find . -type f -cnewer jan ! -cnewer mar -ls

ls is only used for control purpose. -type f might be a wanted restriction or not. xargs -ls lh can be omitted by using finds -printf format, see the manpage for the multiple options.

user unknown
  • 35,537
  • 11
  • 75
  • 121