I have a number of files in a directory:
img1_1.jpg, img1_2.jpg ... img1_199.jpg, img1_2000.jpg
I would like to output a listing of these files to a csv containing only: filename, datetime
For example:
img1_116.jpg,2011-05-25 22:00:49.000000000 +0000
I am trying:
ls -l --time-style="full-iso" img1* | awk '/^-/ && $1=$1' OFS=","
But the date/time keeps getting split up due to the space in the date/time format:
img1_116.jpg,2011-05-25,22:00:49.000000000,+0000
(This is just an example, my actual output still contains the rights, user, group etc)
Is there a way to:
ls
and select only filename and date/time?Does something like ls -l --time-style=full-iso | awk '/^-/ {printf "%s,%s %s\n",$NF,$6,$7}'
do what you want?