I'm using an awk script to print the oldest and newest files created based on the date (the 6th 7th and 8th field).
my sample list, date in the format (YYYY/MM/DD):
file was created 2020/10/10 20:18:42 its name is output1
file was created on 2020/09/10 12:13:22 its name is foobar.awk
file was created on 2020/10/10 20:12:43 its name is output2
file was created on 2020/12/10 18:11:38 its name is foobar.bash
file was created on 2020/12/10 22:32:13 its name is output.txt
what it should look like:
Oldest file date :
2020/09/10 12:13:22
file name: foobar.awk
Newest file date :
2020/12/10 22:32:13
file name: output,txt
Note: I can only use awk I only want the oldest and newest files to be printed.
Also: I am NOT sorting my files, just simply printing the oldest and newest files.