{"id":643,"date":"2008-02-06T11:55:00","date_gmt":"2008-02-06T17:55:00","guid":{"rendered":"http:\/\/www.cls-solutions.com\/blog\/?p=643"},"modified":"2008-02-06T11:55:00","modified_gmt":"2008-02-06T17:55:00","slug":"global-rename-ksh-scripts","status":"publish","type":"post","link":"http:\/\/www.cls-solutions.com\/blog\/global-rename-ksh-scripts\/","title":{"rendered":"Global Rename Ksh Scripts"},"content":{"rendered":"<p><span style=\"font-style:italic;\">These 2 files consisting of 10 lines of code allows you to rename a string within the  whole file system. I&#8217;ve used this when creating new development environments and limited changes that pertain to only one set of directories. It keeps a record of changed files so you can double check that it doesnt do anything unexpected. It recreates the files,so permission might need to be changed back to the originals. <br \/>Note:<br \/>-$1 is the parameter search string to change<br \/>-*sh is the file filter criteria<br \/>-String1 is the string to change [same as $1 above]<br \/>-String2 is the desired new string name <\/span><\/p>\n<p><span style=\"font-weight:bold;\">f_find_it.sh<\/span><br \/>find . -name &#8216;*sh&#8217; -exec grep -l &#8220;$1&#8221; {} \\; > files.txt<br \/>ksh f_callsed.sh files.txt<br \/>ksh work1<br \/>rm work.1<\/p>\n<hr \/>\n<p><span style=\"font-weight:bold;\">f_callsed.sh<\/span><br \/>let x=1<br \/>while read -u3 f1; do<br \/>    printf &#8220;sed -e &#8216;s\/String1\/String2\/g&#8217; $f1 > work.$x\\n&#8221; >>work1<br \/>    printf &#8220;cp work.$x $f1\\n&#8221;>>work1 <br \/>    cat work1<br \/>done 3<$1 \n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>These 2 files consisting of 10 lines of code allows you to rename a string within the whole file system. I&#8217;ve used this when creating new development environments and limited changes that pertain to only one set of directories. It keeps a record of changed files so you can double check that it doesnt do [&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-643","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/posts\/643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/comments?post=643"}],"version-history":[{"count":0,"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/posts\/643\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/media?parent=643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/categories?post=643"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/tags?post=643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}