I'm attempting to extract the contents of some files by alphabetical (which in this case also means date and iteration) order and when I test the process first with ls:
$ find /opt/minecraft/wonders/logs/ -name 20* -type f -mtime -3 -print0 \
| sort | xargs -r0 ls -l | awk -F' ' '{print $6 " " $7 " " $9}'
I get a positive result:
Aug 18 /opt/minecraft/wonders/logs/2018-08-17-3.log.gz
Aug 18 /opt/minecraft/wonders/logs/2018-08-18-1.log.gz
Aug 19 /opt/minecraft/wonders/logs/2018-08-18-2.log.gz
Aug 19 /opt/minecraft/wonders/logs/2018-08-19-1.log.gz
Aug 20 /opt/minecraft/wonders/logs/2018-08-19-2.log.gz
Aug 20 /opt/minecraft/wonders/logs/2018-08-20-1.log.gz
However, when I go to actually extract the files the sort order is lost:
$ find /opt/minecraft/wonders/logs/ -name 20* -type f -mtime -3 -print0 \
| sort | xargs -r0 gunzip -vc | grep "\/opt.*"`
/opt/minecraft/wonders/logs/2018-08-18-1.log.gz: 66.8%
/opt/minecraft/wonders/logs/2018-08-18-2.log.gz: 83.1%
/opt/minecraft/wonders/logs/2018-08-19-1.log.gz: 70.3%
/opt/minecraft/wonders/logs/2018-08-19-2.log.gz: 72.9%
/opt/minecraft/wonders/logs/2018-08-20-1.log.gz: 73.3%
/opt/minecraft/wonders/logs/2018-08-17-3.log.gz: 90.2%
How can I maintain the sort order while unzipping these files?