I have some 10 files of particular pattern coming every day on my server in "tmp" directory like below:
abc1.px , abc2.px, mno.px is common everday. Date part changes.
I want to pick up the latest ".gz" file of each pattern and decompress it without affecting the original zipped files. Then I want to send the name of each of these unzipped files into another file suppose "xyz.txt" in same "tmp" directory along with the path. So, my file xyz.txt should contain:
/tmp/abc1.px.20200820034058 /tmp/abc2.px.20200820062036 /tmp/mno.px.20200819192323
I tried using below command but it didn't work:
gzip -d | ls -t /tmp/abc1.gz*| head -1 > /tmp/abc.txt*
What can be the correct way to achieve this?