document.write('<link rel="stylesheet" href="http://gist.github.com/stylesheets/gist/embed.css"/>')





document.write('<div id=\"gist-64412\" class=\"gist\">\n  \n  \n    \n            \n\n      <div class=\"gist-file\">\n        <div class=\"gist-data gist-syntax\">\n          \n          \n          \n            <div class=\"gist-highlight\"><pre><div class=\"line\" id=\"LC1\"><span class=\"c\">#! /bin/bash<\/span><\/div><div class=\"line\" id=\"LC2\">&nbsp;<\/div><div class=\"line\" id=\"LC3\"><span class=\"c\"># recursively searching current directory for &quot;foo&quot; in PHP files and replace it with &quot;bar&quot;<\/span><\/div><div class=\"line\" id=\"LC4\"><span class=\"k\">for <\/span>i in <span class=\"sb\">`<\/span>find . -depth -name <span class=\"s2\">&quot;*.php&quot;<\/span> -exec grep -Hni <span class=\"s2\">&quot;foo&quot;<\/span> | awk -F: <span class=\"s1\">&#39;{print $1}&#39;<\/span><span class=\"sb\">`<\/span>; <span class=\"k\">do<\/span><\/div><div class=\"line\" id=\"LC5\"><span class=\"k\">    if<\/span> <span class=\"o\">[<\/span> -f <span class=\"s2\">&quot;$i&quot;<\/span> <span class=\"o\">]<\/span>; <span class=\"k\">then<\/span><\/div><div class=\"line\" id=\"LC6\"><span class=\"k\">        <\/span>sed -i <span class=\"s2\">&quot;.old&quot;<\/span> -e <span class=\"s2\">&quot;s/foo/bar/g&#39; &quot;<\/span><span class=\"nv\">$i<\/span><span class=\"err\">&quot;<\/span><\/div><div class=\"line\" id=\"LC7\">&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"k\">fi<\/span><\/div><div class=\"line\" id=\"LC8\"><span class=\"k\">done<\/span>;<\/div><\/pre><\/div>\n          \n        <\/div>\n\n        <div class=\"gist-meta\">\n          <a href=\"http://gist.github.com/raw/64412/a15401562c9128205d0544a7fbebe86f783392d1/demo.sh\" style=\"float:right;\">view raw<\/a>\n          <a href=\"http://gist.github.com/64412#file_demo.sh\" style=\"float:right;margin-right:10px;color:#666\">demo.sh<\/a>\n          <a href=\"http://gist.github.com/64412\">This Gist<\/a> brought to you by <a href=\"http://github.com\">GitHub<\/a>.\n        <\/div>\n      <\/div>\n    \n  \n<\/div>\n')
