<?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>Pario TechnoBlob &#187; sed</title>
	<atom:link href="http://pario.no/tag/sed/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Thu, 02 Feb 2012 13:17:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Replace specific HTML tags using sed and regular expression</title>
		<link>http://pario.no/2009/06/12/replace-specific-html-tags-using-sed-and-regular-expression/</link>
		<comments>http://pario.no/2009/06/12/replace-specific-html-tags-using-sed-and-regular-expression/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 13:33:22 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://pario.no/?p=1126</guid>
		<description><![CDATA[In this post I would like to replace all &#60;embed&#62; HTML tags in a HTML file with a &#60;strong&#62; tag. # sed -e 's/&#60;embed[^>]*&#62;/&#60;strong&#62;/g' filename.html > newfile.html And if you would like to remove the &#60;embed&#62; tag altogether # sed -e 's/&#60;embed[^>]*&#62;//g' filename.html > newfile.html To remove all HTML tags in a file # sed [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I would like to replace all &lt;embed&gt; HTML tags in a HTML file with a &lt;strong&gt; tag.</p>
<pre>
# sed -e 's/&lt;embed[^>]*&gt;/&lt;strong&gt;/g' filename.html > newfile.html</pre>
<p>And if you would like to remove the &lt;embed&gt; tag altogether</p>
<pre>
# sed -e 's/&lt;embed[^>]*&gt;//g' filename.html > newfile.html</pre>
<p>To remove all HTML tags in a file</p>
<pre>
# sed -e 's/&lt;[^>]*&gt;//g' filename.html > newfile.html</pre>
<p>The result file newfile.html is now without any &lt; HTML tags &gt;.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDkvMDYvMTIvcmVwbGFjZS1zcGVjaWZpYy1odG1sLXRhZ3MtdXNpbmctc2VkLWFuZC1yZWd1bGFyLWV4cHJlc3Npb24vPHdwdGI%2BUmVwbGFjZSBzcGVjaWZpYyBIVE1MIHRhZ3MgdXNpbmcgc2VkIGFuZCByZWd1bGFyIGV4cHJlc3Npb248d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2009/06/12/replace-specific-html-tags-using-sed-and-regular-expression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IP address change notifier script</title>
		<link>http://pario.no/2009/01/21/ip-address-change-notifier-script/</link>
		<comments>http://pario.no/2009/01/21/ip-address-change-notifier-script/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 12:57:16 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Photo etc]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ifconfig]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://pario.no/?p=922</guid>
		<description><![CDATA[This is a simple bash script that is run by crontab every 5 minutes on a linux box. It e-mails me the new address when a change of IP address is detected. The script (ipchangemail.sh) #!/bin/bash # Check if IP-address has changed. If a change has occured, mail me the new address # Add the [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple bash script that is run by crontab every 5 minutes on a linux box.<br />
It e-mails me the new address when a change of IP address is detected.</p>
<p>The script (ipchangemail.sh)</p>
<pre>
#!/bin/bash 

# Check if IP-address has changed. If a change has occured, mail me the new address
# Add the following line to crontab if you would like it to be run every 5 minutes:
# */5 * * * * ./ipchangemail.sh

# The network interface I want to monitor
NET_INTERFACE=eth0

# File to keep the latest IP address
IP_FILE=myip.txt

# Mail to this address when a change occur
MAILTO=mail@example.com

# Read the previous IP address from file
source $IP_FILE

CURRENT_IP=`/sbin/ifconfig $NET_INTERFACE | sed -n "/inet addr:.*255.255.25[0-5].[0-9]/{s/.*inet addr://; s/ .*//; p}"`

if [ "$CURRENT_IP" != "$OLD_IP" ]
then
        # Send email about address change
        `echo "New IP address detected: $CURRENT_IP" | mail -s "New IP address" $MAILTO`

        # Write new address to file
        `echo "OLD_IP=$CURRENT_IP" > $IP_FILE`
fi
</pre>
<p>The script can be downloaded <a href="http://pario.no/wp-content/uploads/2009/01/ipchangemail.sh">here</a>.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDkvMDEvMjEvaXAtYWRkcmVzcy1jaGFuZ2Utbm90aWZpZXItc2NyaXB0Lzx3cHRiPklQIGFkZHJlc3MgY2hhbmdlIG5vdGlmaWVyIHNjcmlwdDx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2009/01/21/ip-address-change-notifier-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache web connections pr hour</title>
		<link>http://pario.no/2008/02/21/apache-web-connections-pr-hour/</link>
		<comments>http://pario.no/2008/02/21/apache-web-connections-pr-hour/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 22:26:15 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://pario.no/2008/02/21/428/</guid>
		<description><![CDATA[This is a bash oneliner to show Apache web connections pr hour. It lists up the IPs that has accessed your webserver and the amount og accesses. # cat /var/log/apache2/access_log_pario.no &#124; grep "21/Jan/2008:.." &#124; awk {' print $4":"$1 '} &#124; sed 's/\[//g' &#124; awk -F : {' print $1":"$2"\t\t"$5 '} &#124; sort &#124; uniq -c [...]]]></description>
			<content:encoded><![CDATA[<p>This is a bash oneliner to show Apache web connections pr hour. It lists up the IPs that has accessed your webserver and the amount og accesses.</p>
<pre>
# cat /var/log/apache2/access_log_pario.no | grep "21/Jan/2008:.." | awk {' print $4":"$1 '} | sed 's/\[//g' | awk -F : {' print $1":"$2"\t\t"$5 '} | sort | uniq -c</pre>
<p>Example output</p>
<pre>
37 21/Jan/2008:00          192.168.0.10</pre>
<p>This shows that I had 37 hits from 00:00 &#8211; 01:00 in 20th February 2008.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDgvMDIvMjEvYXBhY2hlLXdlYi1jb25uZWN0aW9ucy1wci1ob3VyLzx3cHRiPkFwYWNoZSB3ZWIgY29ubmVjdGlvbnMgcHIgaG91cjx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2008/02/21/apache-web-connections-pr-hour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strip the kernel to contain only needed modules</title>
		<link>http://pario.no/2007/12/04/strip-the-kernel-to-contain-only-needed-modules/</link>
		<comments>http://pario.no/2007/12/04/strip-the-kernel-to-contain-only-needed-modules/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 14:38:45 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cut]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[lsmod]]></category>
		<category><![CDATA[modinfo]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://pario.no/2007/12/04/strip-the-kernel-to-contain-only-needed-modules/</guid>
		<description><![CDATA[This is a great page with som nice bash scripts describing how to remove unwanted modules from your kernel.]]></description>
			<content:encoded><![CDATA[<p>This is a great page with som nice bash scripts describing <a href="http://wiki.linuxquestions.org/wiki/Configuring_linux_kernel">how to remove unwanted modules from your kernel</a>.</p>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/wiki.linuxquestions.org\/wiki\/Configuring_linux_kernel"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMTIvMDQvc3RyaXAtdGhlLWtlcm5lbC10by1jb250YWluLW9ubHktbmVlZGVkLW1vZHVsZXMvPHdwdGI%2BU3RyaXAgdGhlIGtlcm5lbCB0byBjb250YWluIG9ubHkgbmVlZGVkIG1vZHVsZXM8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/12/04/strip-the-kernel-to-contain-only-needed-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using TCP Wrappers to deny daemon access in specified hours</title>
		<link>http://pario.no/2007/10/25/using-tcp-wrappers-to-deny-daemon-access-in-specified-hours/</link>
		<comments>http://pario.no/2007/10/25/using-tcp-wrappers-to-deny-daemon-access-in-specified-hours/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 18:30:22 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://pario.no/2007/10/25/using-tcp-wrappers-to-deny-daemon-access-in-specified-hours/</guid>
		<description><![CDATA[By doing the following you can deny certain daemons to be available in specified hours by using hosts.allow and hosts.deny. In my example I will be using the vsftpd daemon by adding tcp_wrapper=YES in /etc/vsftpd.conf. Make sure that your private network has access all the time by adding this in /etc/hosts.allow vsftpd: 192.168.0. Enables access [...]]]></description>
			<content:encoded><![CDATA[<p>By doing the following you can deny certain daemons to be available in specified hours by using <strong>hosts.allow</strong> and <strong>hosts.deny</strong>.</p>
<p>In my example I will be using the vsftpd daemon by adding</p>
<pre>
tcp_wrapper=YES</pre>
<p>in <strong>/etc/vsftpd.conf</strong>.</p>
<p>Make sure that your private network has access all the time by adding this in <strong>/etc/hosts.allow</strong></p>
<pre>
vsftpd: 192.168.0.</pre>
<p>Enables access to the whole subnet.</p>
<p>Next you create a <strong>/etc/cron.d/vsftpd</strong> file</p>
<pre>
0 16 * * 1-5 root perl -i -p -e s/innhold//ig /etc/hosts.deny
0 8 * * 1-5 root echo "vsfdpt:ALL &gt;&gt; /etc/hosts.deny</pre>
<p>Reload the cron daemon and you&#8217;re good to go.</p>
<p>The above example will deny all addresses, except those specified in hosts.allow, between 08:00 and 16:00 Monday to Friday and clear the block at other times.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMTAvMjUvdXNpbmctdGNwLXdyYXBwZXJzLXRvLWRlbnktZGFlbW9uLWFjY2Vzcy1pbi1zcGVjaWZpZWQtaG91cnMvPHdwdGI%2BVXNpbmcgVENQIFdyYXBwZXJzIHRvIGRlbnkgZGFlbW9uIGFjY2VzcyBpbiBzcGVjaWZpZWQgaG91cnM8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/10/25/using-tcp-wrappers-to-deny-daemon-access-in-specified-hours/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

