{"id":118,"date":"2009-04-05T17:42:07","date_gmt":"2009-04-05T16:42:07","guid":{"rendered":"http:\/\/www.instruyete.org\/?p=118"},"modified":"2009-04-05T17:42:07","modified_gmt":"2009-04-05T16:42:07","slug":"bash-quoting-tipps-in-der-for-schleife","status":"publish","type":"post","link":"https:\/\/www.instruyete.org\/?p=118","title":{"rendered":"bash Quoting Tipps in der for Schleife"},"content":{"rendered":"<p>Beim massenhaften umbennen von Dateinamen, die Leerzeichen beinhalten, muss man sorgf\u00e4ltig das Quoting beachten, das zwar logisch aber auch fehleranf\u00e4llig ist.<\/p>\n<p>Bsp: Umbennenen von<\/p>\n<pre>File 01.suffix.manipulated\u00a0 -&gt; File 01.newSuffix<\/pre>\n<pre>File 02.suffix.manipulated -&gt; File 02.newSuffix<\/pre>\n<pre>.....<\/pre>\n<p>Dieser klassische batch Job wird mit folgendem Befehl erledigt.<\/p>\n<pre><\/pre>\n<pre>for i in *.suffix.manipulated ; do mv \"$i\" \"`basename \"$i\" suffix.manipulated`newSuffix\" ; done<\/pre>\n<p>Wichtig ist, dass alle Suchergebnisse $i mit Anf\u00fchrungszeichen gequotet werden. Daneben muss aber das Ziel beim mv Kommando, welches mit backspace Quoting prim\u00e4r aufgel\u00f6st wird auch nochmal komplett gequotet werden muss &#8222;` &#8230; `&#8220;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Beim massenhaften umbennen von Dateinamen, die Leerzeichen beinhalten, muss man sorgf\u00e4ltig das Quoting beachten, das zwar logisch aber auch fehleranf\u00e4llig ist. Bsp: Umbennenen von File 01.suffix.manipulated\u00a0 -&gt; File 01.newSuffix File 02.suffix.manipulated -&gt; File 02.newSuffix &#8230;.. Dieser klassische batch Job wird mit folgendem Befehl erledigt. for i in *.suffix.manipulated ; do mv &#8222;$i&#8220; &#8222;`basename &#8222;$i&#8220; suffix.manipulated`newSuffix&#8220; &hellip; <a href=\"https:\/\/www.instruyete.org\/?p=118\" class=\"more-link\"><span class=\"screen-reader-text\">bash Quoting Tipps in der for Schleife<\/span> weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-118","post","type-post","status-publish","format-standard","hentry","category-unix"],"_links":{"self":[{"href":"https:\/\/www.instruyete.org\/index.php?rest_route=\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.instruyete.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.instruyete.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.instruyete.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.instruyete.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=118"}],"version-history":[{"count":0,"href":"https:\/\/www.instruyete.org\/index.php?rest_route=\/wp\/v2\/posts\/118\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.instruyete.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.instruyete.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.instruyete.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}