awk - bash script for comparing -
i trying write bash script.
i on amazon-s3. have bucket1, contains bucket2, bucket3, bucket4. bucket 2 has b1, b2, b3, b4, b5 - in each of them contain tar files being created nd file name.
when s3cmd --recursive ls s3://bucket1/bucket2/ | awk '{print$1}'
print date of tar files generated.
i want date on computer compare list , print last 1 week of files have been created.
format of date on s3 : year/month/date
thank you.
you can use gnu date +%s
option seconds, , compare dates in whatever format, i.e.
> (( ( $(date +%s) - $(date -d "2014/03/08" +%s) ) < (7*24*60*60) )) \ && echo "less week ago" \ || echo "more week ago" more week ago > (( ( $(date +%s) - $(date -d "2014/04/03" +%s) ) < (7*24*60*60) )) \ && echo "less week ago" \ || echo "more week ago" less week ago
Comments
Post a Comment