<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stefan Sobek Blog &#187; MacOS</title>
	<atom:link href="http://www.sobek.info/blog/category/macos/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sobek.info/blog</link>
	<description>Writing about IT, Software Engineering, sports and other stuff</description>
	<lastBuildDate>Mon, 24 Jan 2011 12:50:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Short Maven introduction</title>
		<link>http://www.sobek.info/blog/2010/03/02/short-maven-introduction/</link>
		<comments>http://www.sobek.info/blog/2010/03/02/short-maven-introduction/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 13:28:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[maven2]]></category>
		<category><![CDATA[mvn]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=231</guid>
		<description><![CDATA[Due to the fact I got in touch with maven2 and I think that maven2 is very helpful will give a short introduction. Bigger projects normally have a more complex configuration but I will start from the scratch.
Maven will create a kind of project sceleton with the following command

?View Code JAVA1
mvn archetype:create -DgroupId=info.sobek.testapp -DartifactId=testapp

If you [...]]]></description>
			<content:encoded><![CDATA[<p>Due to the fact I got in touch with maven2 and I think that maven2 is very helpful will give a short introduction. Bigger projects normally have a more complex configuration but I will start from the scratch.</p>
<p><strong>Maven will create a kind of project sceleton with the following command</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code3'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2313"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p231code3"><pre class="java" style="font-family:monospace;">mvn archetype<span style="color: #339933;">:</span>create <span style="color: #339933;">-</span>DgroupId<span style="color: #339933;">=</span>info.<span style="color: #006633;">sobek</span>.<span style="color: #006633;">testapp</span> <span style="color: #339933;">-</span>DartifactId<span style="color: #339933;">=</span>testapp</pre></td></tr></table></div>

<p>If you work with e.g. eclipse, you can create the project files for eclipse:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code4'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2314"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p231code4"><pre class="java" style="font-family:monospace;">mvn eclipse<span style="color: #339933;">:</span>eclipse</pre></td></tr></table></div>

<p>Now you can import it into eclipse with &#8220;import into existing workspace&#8221; option of eclipse. </p>
<p>Maven will normally copy the created so called &#8220;artifacts&#8221; into your local maven repository. Normally located under your home dir and then .m2</p>
<p>When you program depends on several jars and these dependencies are defined in the pom.xml, then maven will copy the jars in their specific version into the local maven repository. This is very helpful because you can simply build your project with another newer or older version of your dependent jar-file. </p>
<p>How to create multi-module projects will be explained in another episode. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2010/03/02/short-maven-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Download files with curl</title>
		<link>http://www.sobek.info/blog/2009/12/20/download-files-with-curl/</link>
		<comments>http://www.sobek.info/blog/2009/12/20/download-files-with-curl/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 13:31:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=205</guid>
		<description><![CDATA[If you want to download a file with curl type the following code into bash:

?View Code BASH1
curl -O http://www.url.de/file.html

-O means to output to a file and not to stdout, normally the screen.
What if you need to resume a download of a big file?

?View Code BASH1
curl -C - -O http://www.url.de/file.html

With -C &#8211; you continue downloading the [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to download a file with curl type the following code into bash:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p205code8'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2058"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p205code8"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-O</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.url.de<span style="color: #000000; font-weight: bold;">/</span>file.html</pre></td></tr></table></div>

<p>-O means to output to a file and not to stdout, normally the screen.</p>
<p>What if you need to resume a download of a big file?</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p205code9'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2059"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p205code9"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-C</span> - <span style="color: #660033;">-O</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.url.de<span style="color: #000000; font-weight: bold;">/</span>file.html</pre></td></tr></table></div>

<p>With -C &#8211; you continue downloading the current file. If is important to write <strong>-C -</strong>. Don&#8217;t forget the -</p>
<p>You can also set a referrer and the user agent.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p205code10'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p20510"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p205code10"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-C</span> - <span style="color: #660033;">-O</span> <span style="color: #660033;">-A</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.url.de <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6&quot;</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.url.de<span style="color: #000000; font-weight: bold;">/</span>file.html</pre></td></tr></table></div>

<p>With -A you can set the referrer and -e sets the user agent.</p>
<p>Pretty helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/12/20/download-files-with-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screen command usage &#8211; part 2</title>
		<link>http://www.sobek.info/blog/2009/12/08/screen-command-usage-part-2/</link>
		<comments>http://www.sobek.info/blog/2009/12/08/screen-command-usage-part-2/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 08:57:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOS]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=66</guid>
		<description><![CDATA[To detach from an actual session press

?View Code BASH1
Ctrl+a d

Reattach with

?View Code BASH1
screen  -r

To list the actual detached sessions:

?View Code BASH1
screen  -list

You will see something like:

?View Code BASH1
2
4840.pts-3.localhost  &#40;Detached&#41;
4628.pts-1.localhost &#40;Detached&#41;

Reattach it with:

?View Code BASH1
screen  -r 4840.pts-3.localhost

To share a session with another user you have to ensure some steps.
Set the screen binary [...]]]></description>
			<content:encoded><![CDATA[<p>To detach from an actual session press</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code20'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6620"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code20"><pre class="bash" style="font-family:monospace;">Ctrl+a d</pre></td></tr></table></div>

<p>Reattach with</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code21'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6621"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code21"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span>  <span style="color: #660033;">-r</span></pre></td></tr></table></div>

<p>To list the actual detached sessions:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code22'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6622"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code22"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span>  <span style="color: #660033;">-list</span></pre></td></tr></table></div>

<p>You will see something like:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code23'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6623"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p66code23"><pre class="bash" style="font-family:monospace;">4840.pts-3.localhost  <span style="color: #7a0874; font-weight: bold;">&#40;</span>Detached<span style="color: #7a0874; font-weight: bold;">&#41;</span>
4628.pts-1.localhost <span style="color: #7a0874; font-weight: bold;">&#40;</span>Detached<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<p>Reattach it with:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code24'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6624"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code24"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span>  <span style="color: #660033;">-r</span> 4840.pts-3.localhost</pre></td></tr></table></div>

<p>To share a session with another user you have to ensure some steps.</p>
<p>Set the screen binary setuid root:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code25'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6625"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code25"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span>  +s <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">screen</span></pre></td></tr></table></div>

<p>Login as root and start a screen session and name it:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code26'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6626"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code26"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">-S</span> sessionName</pre></td></tr></table></div>

<p>Enable multi-user access function by pressing Ctrl+a then :multiuser on (to type &#8220;:&#8221;, press  &#8220;shift+;&#8221;)<br />
Grant permissions to the second user by pressing Ctrl+a: acladd  <em>username</em>, where username is the Unix user for the second user.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code27'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6627"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code27"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span>  <span style="color: #660033;">-x</span> root<span style="color: #000000; font-weight: bold;">/</span>sessionName</pre></td></tr></table></div>

<p>Activate logging with:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code28'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6628"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code28"><pre class="bash" style="font-family:monospace;">Ctrl+a H</pre></td></tr></table></div>

<p>A file in your home directory will be created. Something like $HOME/screenlog.1</p>
<p>Type <em>exit </em>to exit screen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/12/08/screen-command-usage-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Search and replace with linux in files</title>
		<link>http://www.sobek.info/blog/2009/11/25/search-and-replace-with-linux-in-files/</link>
		<comments>http://www.sobek.info/blog/2009/11/25/search-and-replace-with-linux-in-files/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 15:39:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[search and replace]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=56</guid>
		<description><![CDATA[To replace a string in all files inside a folder you can create a bash file:

?View Code BASH1
vi replace.sh

Put inside this file:

?View Code BASH1
2
3
4
5
6
#!/bin/bash
for file in $&#40;ls -1&#41;;
do
sed 's/me/you/g' $file &#38;gt; /tmp/dummy.txt;
mv /tmp/dummy.txt $file;
done

Save it and make it executeable (chmod 777 replace.sh)
In this case the string &#8220;me&#8221; will be replace with &#8220;you&#8221; in all files [...]]]></description>
			<content:encoded><![CDATA[<p>To replace a string in all files inside a folder you can create a bash file:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p56code33'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p5633"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p56code33"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> replace.sh</pre></td></tr></table></div>

<p>Put inside this file:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p56code34'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p5634"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p56code34"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ls</span> -1<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/me/you/g'</span> <span style="color: #007800;">$file</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>dummy.txt;
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>dummy.txt <span style="color: #007800;">$file</span>;
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>Save it and make it executeable (chmod 777 replace.sh)</p>
<div>In this case the string &#8220;me&#8221; will be replace with &#8220;you&#8221; in all files of the actual folder and the files will be overridden.</div>
<div></div>
<div><strong>Another example</strong></div>
<div>Your want to replace the tag &lt;b&gt; with &lt;strong&gt; in all files inside a special folder. Further you want to backup the original files with suffix .old and the new files will be overridden.</div>
<div></div>
<div>Simply type on the console:</div>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p56code35'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p5635"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p56code35"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ls</span> -1<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$file</span> <span style="color: #007800;">$file</span>.old
<span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/&amp;lt;b&amp;gt;/&amp;lt;strong&amp;gt;/g'</span> <span style="color: #007800;">$file</span>.old <span style="color: #000000; font-weight: bold;">&amp;</span>gt;  <span style="color: #007800;">$file</span>;
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<div>You can modify the script(s). Maybe by adding parameters etc.</div>
<p>Another option is to use sed with -i command or direct editing:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p56code36'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p5636"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p56code36"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ls</span> -1<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">'s/text_to_replace/text_replacement/g'</span> <span style="color: #007800;">$file</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/11/25/search-and-replace-with-linux-in-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top command differences in Linux and Mac</title>
		<link>http://www.sobek.info/blog/2009/11/19/top-command-differences-in-linux-and-mac/</link>
		<comments>http://www.sobek.info/blog/2009/11/19/top-command-differences-in-linux-and-mac/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 08:46:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[top]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=45</guid>
		<description><![CDATA[When switching from Mac to Linux and vice versa, I always have to think a bit about how to use the command top and sort by CPU.
With Linux it is
top
and then press
shift+p
Mac:
top -o cpu
I hope I can remember this  
]]></description>
			<content:encoded><![CDATA[<p>When switching from Mac to Linux and vice versa, I always have to think a bit about how to use the command top and sort by CPU.</p>
<p>With <strong>Linux</strong> it is</p>
<blockquote><p>top</p></blockquote>
<p>and then press</p>
<blockquote><p>shift+p</p></blockquote>
<p><strong>Mac</strong>:</p>
<blockquote><p>top -o cpu</p></blockquote>
<p>I hope I can remember this <img src='http://www.sobek.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/11/19/top-command-differences-in-linux-and-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursive search inside files with linux/unix/mac</title>
		<link>http://www.sobek.info/blog/2009/11/18/recursive-search-inside-files-with-linuxunixmac/</link>
		<comments>http://www.sobek.info/blog/2009/11/18/recursive-search-inside-files-with-linuxunixmac/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 14:52:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[filesearch]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[recursive]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=43</guid>
		<description><![CDATA[The situation is as follows. You want to search recursive for a text pattern inside of each files in the directory /var/www/vhosts. Take e.g. the pattern &#8216;DataStructure&#8217;.
Normally you would think about the find-command and executing another command but grep itself can do the job.
grep -RHl -e &#8216;DataStructure&#8217; /srv/www/vhosts
This command lists all filenames containing the text [...]]]></description>
			<content:encoded><![CDATA[<p>The situation is as follows. You want to search recursive for a text pattern inside of each files in the directory /var/www/vhosts. Take e.g. the pattern &#8216;DataStructure&#8217;.</p>
<p>Normally you would think about the find-command and executing another command but grep itself can do the job.</p>
<blockquote><p>grep -RHl -e &#8216;DataStructure&#8217; /srv/www/vhosts</p></blockquote>
<p>This command lists all filenames containing the text &#8216;DataStructure&#8217;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/11/18/recursive-search-inside-files-with-linuxunixmac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MacOS X &#8211; mit scp Dateien kopieren, kein Problem, oder?</title>
		<link>http://www.sobek.info/blog/2008/02/29/macos-x-mit-scp-dateien-kopieren-kein-problem-oder/</link>
		<comments>http://www.sobek.info/blog/2008/02/29/macos-x-mit-scp-dateien-kopieren-kein-problem-oder/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 16:02:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MacOS]]></category>
		<category><![CDATA[Console]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[scp]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/2008/02/29/macos-x-mit-scp-dateien-kopieren-kein-problem-oder/</guid>
		<description><![CDATA[Möchte man mit scp kopieren so ist das generell kein Problem:
scp *.java user@servername.de:/home/user/
Läuft ssh über einen anderen Port, so ist das auch kein Problem:
scp -P 12345 *.java user@servername.de:/home/user/
Beachte: Bei ssh muss man ein kleines -p für die Angabe des Ports benutzen, bei scp muss dies ein große -P sein.
Soweit so gut und auch alles von [...]]]></description>
			<content:encoded><![CDATA[<p>Möchte man mit scp kopieren so ist das generell kein Problem:</p>
<p><code>scp *.java user@servername.de:/home/user/</code></p>
<p>Läuft ssh über einen anderen Port, so ist das auch kein Problem:</p>
<p><code>scp -P 12345 *.java user@servername.de:/home/user/</code></p>
<p>Beachte: Bei <strong>ssh </strong>muss man ein kleines -p für die Angabe des Ports benutzen, bei <strong>scp </strong>muss dies ein große -P sein.</p>
<p>Soweit so gut und auch alles von Linux bekannt also völlig identisch.</p>
<p>Ich verbinde mit immer über ein Key-File:</p>
<p><code>ssh-add myprivatekeyfile</code></p>
<p>Anschließend muss man seine Passphrase eingeben. Befindet sich der Publikkey nun auf dem zu verbindenen Server in der authorized_keys, so kann man jetzt ohne Passwort mit dem Server per ssh verbinden.</p>
<p>So füge ich die Datei in die authorized_keys ein:</p>
<p><code>cat mypublickey &gt;&gt; ~/.ssh/authorized_keys</code></p>
<p>Damit wird der Inhalt des Public Keys in die Datei angefügt.</p>
<p>Aber zurück zum eigentlichen Thema. Ich konnte auf einen bestimmten Server nicht kopieren und war erst völlig ratlos. Nach längerer Analyse hab ich festgestellt, dass in der .bashrc-Datei, also die Datei die bei Login eines Users aufgerufen wird, der Inhalt einer Datei mittels cat ausgegeben wird. So eine Art Begrüssung. Diese Art von Begrüssung unterbindet den Verbindungs- und Kopiervorgang.</p>
<p>Also: Keine Ausgaben in der .bashrc, sonst hat man Probleme beim Kopieren mit scp!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2008/02/29/macos-x-mit-scp-dateien-kopieren-kein-problem-oder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

