Bash

cd /home/www
find . -type f -print0 | xargs -0 sed -i 's/subdomainA.example.com/subdomainB.example.com/g'# From man find:# # -print0 (GNU find only) tells find to use the null character (\0) instead# of whitespace as the output delimiter between pathnames found. This is a# safer option if you files can contain blanks or other special character.# It is recommended to use the -print0 argument to find if you use -exec# command or xargs (the -0 argument is needed in xargs.).

<p>When you run a shell script and got this error</p>
<p><code>
/bin/bash^M: bad interpreter: No such file or directory
</code></p>
<p>then your script contains a bad character which is the carriage return character. To remove these characters you have to run the following command: </p>
<p><code>
sed -i -e 's/\r$//' &lt;your script&gt;.sh
</code></p>

"shell script", linux, shell

Bash

# Clean all dirs that have mvn builds in them to # recover space taken up by /target dirs that are not usedfor foo in *;docd$foo; mvn clean;cd ..;done# clean all SNAPSHOT items from the local maven repocd .m2/repository && find . -name '*-SNAPSHOT' -print0 | xargs -0 rm -rf

Text only

#I came up with a situation where i need to append @ and PATH at th starting of the all files that are modified on particular day here what i did
ls -lt|grep "Sep 24" | awk '{print $9}'|sed 's/^/@\/Users\/chakri\/projects\//g'

<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>#I came up with a situation where i need to append @ and PATH at th starting of the all files that are modified on particular day here what i did
</span><span id="L-2"><a name="L-2"></a>
</span><span id="L-3"><a name="L-3"></a>ls -lt|grep &quot;Sep 24&quot; | awk &#39;{print $9}&#39;|sed &#39;s/^/@\/Users\/chakri\/projects\//g&#39;
</span></pre></div>
</td></tr></table>

Bash

#!/bin/bash# USAGE:# Save this file as whatever.command and make sure this file is executable.# To make it executable, simply open up your Mac's terminal, cd to the folder# where you've saved this file and then run: $ chmod +x whatever.command# # To execute the file, save it in your Desktop or Home folder and simply click on# it whenever you want to sync these folders. Alternatively you could create a cron# job to do this automatically for you.# # To sync multiple folders, simply copy paste the rsync line# and change source and target folders.# Example: sync my GitHub Joomla! template repo to 2 local websites for mult-site testing# Notice the changed path in the second line below...rsync -av --delete ~/Projects/GitHub/myTemplate/ ~/WWW/Joomla25/templates/myTemplate/
rsync -av --delete ~/Projects/GitHub/myTemplate/ ~/WWW/Joomla3x/templates/myTemplate/