{"id":8258,"date":"2018-09-09T12:24:36","date_gmt":"2018-09-09T12:24:36","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=8258"},"modified":"2018-09-09T13:49:05","modified_gmt":"2018-09-09T13:49:05","slug":"bash-script-loop-over-files","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=8258","title":{"rendered":"Bash Script Loop over Files"},"content":{"rendered":"<p><a href=\"https:\/\/stackoverflow.com\/questions\/7039130\/iterate-over-a-list-of-files-with-spaces\">Iterate over a list of files with spaces<\/a><br \/>\n<a href=\"https:\/\/unix.stackexchange.com\/questions\/9496\/looping-through-files-with-spaces-in-the-names\">Looping through files with spaces in the names?<\/a><br \/>\n<a href=\"https:\/\/unix.stackexchange.com\/questions\/321697\/why-is-looping-over-finds-output-bad-practice\">Why is looping over find&#8217;s output bad practice?<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/2437452\/how-to-get-the-list-of-files-in-a-directory-in-a-shell-script\">How to get the list of files in a directory in a shell script?<\/a><br \/>\n<a href=\"https:\/\/www.cyberciti.biz\/faq\/bash-loop-over-file\/\">Bash Shell Loop Over Set of Files<\/a><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nfind . -maxdepth 1 -iname &quot;*.pdf&quot; | sed &quot;s|^\\.\/||&quot; | while read f\r\ndo\r\n    echo $f\r\ndone\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Iterate over a list of files with spaces Looping through files with spaces in the names? Why is looping over find&#8217;s output bad practice? How to get the list of files in a directory in a shell script? Bash Shell Loop Over Set of Files find . -maxdepth 1 -iname &quot;*.pdf&quot; | sed &quot;s|^\\.\/||&quot; | [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8258","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/8258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8258"}],"version-history":[{"count":5,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/8258\/revisions"}],"predecessor-version":[{"id":8269,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/8258\/revisions\/8269"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}