{"id":4758,"date":"2021-10-20T17:16:01","date_gmt":"2021-10-20T08:16:01","guid":{"rendered":"https:\/\/www.chihayafuru.jp\/tech\/?p=4758"},"modified":"2023-01-03T09:27:54","modified_gmt":"2023-01-03T00:27:54","slug":"find%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89-exec-%e3%82%aa%e3%83%97%e3%82%b7%e3%83%a7%e3%83%b3","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/4758","title":{"rendered":"find\u30b3\u30de\u30f3\u30c9 -exec \u30aa\u30d7\u30b7\u30e7\u30f3"},"content":{"rendered":"<p>POSIX\u6e96\u62e0\u306e find\u30b3\u30de\u30f3\u30c9 \u306e -exec \u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u3064\u304b\u3044\u304b\u305f<\/p>\n<h3>1. \u30b0\u30eb\u30fc\u30d7\u5b9f\u884c<\/h3>\n<pre class=\"lang:default decode:true \" >$ find [\u691c\u7d22\u30d1\u30b9] [\u691c\u7d22\u30aa\u30d7\u30b7\u30e7\u30f3] -exec [\u5b9f\u884c\u30b3\u30de\u30f3\u30c9] {} +<\/pre>\n<pre class=\"lang:default decode:true \" >$ find . -type f -name '*.c' -exec dos2unix {} +<\/pre>\n<p><!--more--><\/p>\n<ul>\n<li>\u30b0\u30eb\u30fc\u30d7\u5b9f\u884c\u3067\u306f\u30b3\u30de\u30f3\u30c9\u306e\u672b\u5c3e\u306b\u300e <strong>+<\/strong> (\u30d7\u30e9\u30b9) \u300f\u3092\u6307\u5b9a\u3059\u308b\u3002<\/li>\n<li><code>{}<\/code> \u306b\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u304c\u5c55\u958b\u3055\u308c\u308b\u3002<\/li>\n<li>\u30b0\u30eb\u30fc\u30d7\u5b9f\u884c\u306f <code>{}<\/code> \u306b\u53ef\u80fd\u306a\u9650\u308a\u8907\u6570\u306e\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3092\u6e21\u3059\u3002<\/li>\n<li>\u3010\u5c55\u958b\u4f8b\u3011 <code>dos2unix .\/foo.c .\/bar.c .\/fiz.c<\/code><\/li>\n<\/ul>\n<h3>2. \u5358\u4f53\u5b9f\u884c<\/h3>\n<pre class=\"lang:default decode:true \" >$ find [\u691c\u7d22\u30d1\u30b9] [\u691c\u7d22\u30aa\u30d7\u30b7\u30e7\u30f3] -exec [\u5b9f\u884c\u30aa\u30d7\u30b7\u30e7\u30f3] {} [\u5f15\u6570] \\;<\/pre>\n<pre class=\"lang:default decode:true \" >$ find . -type f -name '*.c' -exec cp {} .\/src\/ \\;<\/pre>\n<ul>\n<li>\u5358\u4f53\u5b9f\u884c\u3067\u306f\u30b3\u30de\u30f3\u30c9\u306e\u672b\u5c3e\u306b\u300e <strong>;<\/strong> (\u30bb\u30df\u30b3\u30ed\u30f3) \u300f\u3092\u6307\u5b9a\u3059\u308b\u3002<\/li>\n<li>\u30b7\u30a7\u30eb\u5b9f\u884c\u306e\u3068\u304d\u306f\u30bb\u30df\u30b3\u30ed\u30f3\u306e\u76f4\u524d\u306b\u300e <code>\\<\/code> (\u30d0\u30c3\u30af\u30b9\u30e9\u30c3\u30b7\u30e5) \u300f\u3092\u7f6e\u3044\u3066\u30a8\u30b9\u30b1\u30fc\u30d7\u3059\u308b\u3002<\/li>\n<li><code>{}<\/code> \u306b\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u304c\u5c55\u958b\u3055\u308c\u308b\u3002<\/li>\n<li>\u5358\u4f53\u5b9f\u884c\u306f <code>{}<\/code> \u306b\u4e00\u3064\u305a\u3064\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3092\u6e21\u3059\u3002<\/li>\n<li>\u3010\u5c55\u958b\u4f8b\u3011 <code>cp .\/foo.c .\/src\/ ; cp .\/bar.c .\/src\/ ; cp .\/fiz.c .\/src\/<\/code><\/li>\n<\/ul>\n<h3>\u95a2\u9023\u30ea\u30f3\u30af<\/h3>\n<ul>\n<li><a href=\"\/tech\/index.php\/archives\/314\">find\u30b3\u30de\u30f3\u30c9\u306e\u4f7f\u3044\u65b9<\/a><\/li>\n<li><a href=\"\/tech\/index.php\/archives\/3316\">find\u30b3\u30de\u30f3\u30c9\u3067\u7279\u5b9a\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u9664\u5916\u3059\u308b<\/a><\/li>\n<li><a href=\"\/tech\/index.php\/archives\/3793\">\u6587\u5b57\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306b\u3088\u308b\u30d5\u30a1\u30a4\u30eb\u691c\u7d22<\/a><\/li>\n<li><a href=\"\/tech\/index.php\/archives\/3411\">\u7a7a\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u691c\u7d22\u3059\u308b<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>POSIX\u6e96\u62e0\u306e find\u30b3\u30de\u30f3\u30c9 \u306e -exec \u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u3064\u304b\u3044\u304b\u305f 1. \u30b0\u30eb\u30fc\u30d7\u5b9f\u884c $ find [\u691c\u7d22\u30d1\u30b9] [\u691c\u7d22\u30aa\u30d7\u30b7\u30e7\u30f3] -exec [\u5b9f\u884c\u30b3\u30de\u30f3\u30c9] {} + $ find . -type f &#8211; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-4758","post","type-post","status-publish","format-standard","hentry","category-memo"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/4758","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=4758"}],"version-history":[{"count":31,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/4758\/revisions"}],"predecessor-version":[{"id":5919,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/4758\/revisions\/5919"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=4758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=4758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=4758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}