I have file listed in my directory in following format
-rwxrwxr-x+ 1 test test 4.9M Oct 3 16:06 test20141002150108.txt
-rwxrwxr-x+ 1 test test 4.9M Oct 4 16:06 test20141003150108.txt
-rwxrwxr-x+ 1 test test 4.9M Oct 5 16:06 test20141005150108.txt
-rwxrwxr-x+ 1 test test 4.9M Oct 5 16:06 test20141005150108.txt
-rwxrwxr-x+ 1 test test 4.9M Oct 5 16:06 test20141005150108.txt
I want Output in following format
DateMoved FileDate Count Size
Oct 3 20141002 1 4.9
Oct 4 20141003 1 4.9
Oct 5 20141005 3 14.7
Already I am using below script to determine DateMoved,Count and Size.
printf '\nDATE\tFILES\tSIZE\n'
cd /Mydir
ls -lrt | grep "^-" | awk '
{ nkey = $6$7
if(key != nkey && key != "") {
printf("%s\t%d\t%d\n", key, freq, size)
freq = 1;
size = $5
} else {freq++
size += $5
}
key = nkey
}
END { printf("%s\t%d\t%d\n", key, freq, size)
}'
Help me to get FileDate as well based on the file name.
Appreciate your help.
Thanks