I'm working in a HP-UX based machine and I need to list the name of the logs contained in a folder by the date and separated of the name by a ";" and the result, sorted by date in descending order this stored in a txt so the content of the txt will be like:
2019-02-02;/home/user/Documents/imthelog03.log
2019-02-01;/home/user/Documents/imthelog02.log
2019-01-29;/home/user/Documents/imthelog01.log
I've tried this:
find /home/user/Documents/*.log* exec perl -MPOSIX -e 'print POSIX::strftime "%Y%m%d\n", localtime((stat $ARGV[0])[9])'
but I can't get what I need, I can't use stats
I'm using a for
to read line by line
so How can I get the date and the path/filename
separated by a ;
in a txt, sorted by date descending using bash and eventually perl, thanks!