{"id":6056,"date":"2018-12-06T13:20:32","date_gmt":"2018-12-06T13:20:32","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=6056"},"modified":"2018-12-06T13:20:32","modified_gmt":"2018-12-06T13:20:32","slug":"loop-over-a-randomized-list-of-files-in-bash","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/loop-over-a-randomized-list-of-files-in-bash\/","title":{"rendered":"Loop over a randomized list of files in bash"},"content":{"rendered":"<p>You can do this using a combination of &#8220;shuf&#8221; and &#8220;head&#8221;:<\/p>\n<pre lang=\"bash\">\nfor IMAGE in $(ls -c --format=single-column logos\/images | shuf | head -n 10);\ndo\n        echo logos\/images\/$IMAGE        \n        python3 predict.py -m .\/output.h5 -i logos\/images\/$IMAGE --confidence 0.5 --labels logos\/retinanet_classes.csv\ndone\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sort by random files in bash<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[79,338],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6056"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=6056"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6056\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=6056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=6056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=6056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}