{"id":171,"date":"2026-04-19T10:27:03","date_gmt":"2026-04-19T09:27:03","guid":{"rendered":"https:\/\/vpp.dk\/?linux_trick=replace-text-in-multiple-files"},"modified":"2026-04-19T10:27:03","modified_gmt":"2026-04-19T09:27:03","slug":"replace-text-in-multiple-files","status":"publish","type":"linux_trick","link":"https:\/\/vpp.dk\/?linux_trick=replace-text-in-multiple-files","title":{"rendered":"Replace text in multiple files"},"content":{"rendered":"<p>Use sed with find to do a batch search-and-replace across many files at once.<\/p>\n","protected":false},"template":"","meta":{"_trick_code":"# Replace 'foo' with 'bar' in all .conf files:\nfind \/etc -name '*.conf' -exec sed -i 's\/foo\/bar\/g' {} +\n\n# Preview changes first (dry-run):\ngrep -rl 'foo' \/etc\/*.conf","_trick_uploader":"sedmaster"},"trick_category":[16,19],"class_list":["post-171","linux_trick","type-linux_trick","status-publish","hentry","trick_category-file-management","trick_category-text-processing"],"_links":{"self":[{"href":"https:\/\/vpp.dk\/index.php?rest_route=\/wp\/v2\/linux_trick\/171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpp.dk\/index.php?rest_route=\/wp\/v2\/linux_trick"}],"about":[{"href":"https:\/\/vpp.dk\/index.php?rest_route=\/wp\/v2\/types\/linux_trick"}],"wp:attachment":[{"href":"https:\/\/vpp.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=171"}],"wp:term":[{"taxonomy":"trick_category","embeddable":true,"href":"https:\/\/vpp.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftrick_category&post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}