<?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>mod_Perl und OpenWGA &#187; files</title>
	<atom:link href="http://1367.de/tag/files/feed/" rel="self" type="application/rss+xml" />
	<link>http://1367.de</link>
	<description>OpenWGA Sammlung</description>
	<lastBuildDate>Fri, 19 Nov 2010 06:48:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>In PERL how do you open different text files with the same program?</title>
		<link>http://1367.de/2010/11/05/in-perl-how-do-you-open-different-text-files-with-the-same-program/</link>
		<comments>http://1367.de/2010/11/05/in-perl-how-do-you-open-different-text-files-with-the-same-program/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 12:52:39 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[OpenWGA]]></category>
		<category><![CDATA[different]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[Open]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Program]]></category>
		<category><![CDATA[same]]></category>
		<category><![CDATA[text]]></category>
		<guid isPermaLink="false">http://1367.de/2010/11/05/in-perl-how-do-you-open-different-text-files-with-the-same-program/</guid>
		<description><![CDATA[Question by Magician: In PERL how do you open different text files with the same program? Say my code is: # PRO1.pl open (MYFILE, &#8216;data.txt&#8217;); while () { chomp; print &#8220;$ _\n&#8221;; } close (MYFILE); But I want to run all these from this PRO1.pl program $ perl PRO1.pl part1.txt $ perl PRO1.pl part2.txt $ [...]]]></description>
			<content:encoded><![CDATA[<p><strong><i>Question by Magician</i>: In PERL how do you open different text files with the same program?</strong><br />
Say my code is:<br />
# PRO1.pl<br />
open (MYFILE, &#8216;data.txt&#8217;);<br />
while (<MYFILE>) {<br />
chomp;<br />
print &#8220;$ _\n&#8221;;<br />
}<br />
close (MYFILE); </p>
<p>But I want to run all these from this PRO1.pl program </p>
<p>$  perl PRO1.pl part1.txt<br />
$  perl PRO1.pl part2.txt<br />
$  perl PRO1.pl part3.txt</p>
<p>What do I change &#8216;data.txt&#8217; so I can use any text file with this program. </p>
<p>I know I can be change it  to a variable<br />
$ fileName=&#8217;data.txt&#8217;<br />
open (MYFILE, $ fileName);</p>
<p>But how do I get a parameter into the program so that it will open the parameter file and not the variable file.</p>
<p><strong>Best answer:</strong></p>
<p><i>Answer by rknoblock</i><br/>One solution would be to create a file containing the names of files to be processed by the program. The data file used as a parm on the command line would provide the program with a list of files to be processed.  Open that file, read the names of the files into an array, close the file, and then open and process the files named in the array.</p>
<p><strong>What do you think? Answer below!</strong></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d717').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d717" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F&amp;submitHeadline=In+PERL+how+do+you+open+different+text+files+with+the+same+program%3F&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F&amp;title=In+PERL+how+do+you+open+different+text+files+with+the+same+program%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F&amp;title=In+PERL+how+do+you+open+different+text+files+with+the+same+program%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F&amp;title=In+PERL+how+do+you+open+different+text+files+with+the+same+program%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F&amp;bm_description=In+PERL+how+do+you+open+different+text+files+with+the+same+program%3F" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F&amp;T=In+PERL+how+do+you+open+different+text+files+with+the+same+program%3F" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F&amp;title=In+PERL+how+do+you+open+different+text+files+with+the+same+program%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F&amp;title=In+PERL+how+do+you+open+different+text+files+with+the+same+program%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+In+PERL+how+do+you+open+different+text+files+with+the+same+program%3F+@+http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2F1367.de%2F2010%2F11%2F05%2Fin-perl-how-do-you-open-different-text-files-with-the-same-program%2F&amp;t=In+PERL+how+do+you+open+different+text+files+with+the+same+program%3F" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d717').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d717').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://1367.de/2010/11/05/in-perl-how-do-you-open-different-text-files-with-the-same-program/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to show perl/C program files in colors in vi?</title>
		<link>http://1367.de/2010/11/04/how-to-show-perlc-program-files-in-colors-in-vi/</link>
		<comments>http://1367.de/2010/11/04/how-to-show-perlc-program-files-in-colors-in-vi/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 11:53:22 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[OpenWGA]]></category>
		<category><![CDATA[colors]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[perl/C]]></category>
		<category><![CDATA[Program]]></category>
		<category><![CDATA[show]]></category>
		<guid isPermaLink="false">http://1367.de/2010/11/04/how-to-show-perlc-program-files-in-colors-in-vi/</guid>
		<description><![CDATA[Question by arnab: How to show perl/C program files in colors in vi? I want to see the program files (perl/C/C++ etc) in color font when opened in vi editor. Generally it shows, e.g. the &#8216;for&#8217; or &#8216;if&#8217; will be shown in orange color. But in my PC (I have installed open suse very recently) [...]]]></description>
			<content:encoded><![CDATA[<p><strong><i>Question by arnab</i>: How to show perl/C program files in colors in vi?</strong><br />
I want to see the program files (perl/C/C++ etc) in color font when opened in vi editor. Generally it shows, e.g. the &#8216;for&#8217; or &#8216;if&#8217; will be shown in orange color. But in my PC (I have installed open suse very recently) it shows in simple black. I have seen the settings already with no result. Please suggest..</p>
<p><strong>Best answer:</strong></p>
<p><i>Answer by melalona</i><br/>Press ESC and  type : syntax on<br />
or<br />
Open  /etc/vimrc and add  (or uncomment ) this line : syntax on </p>
<p>Best wishes, Mel</p>
<p><strong>Know better? Leave your own answer in the comments!</strong></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d712').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d712" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F&amp;submitHeadline=How+to+show+perl%2FC+program+files+in+colors+in+vi%3F&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F&amp;title=How+to+show+perl%2FC+program+files+in+colors+in+vi%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F&amp;title=How+to+show+perl%2FC+program+files+in+colors+in+vi%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F&amp;title=How+to+show+perl%2FC+program+files+in+colors+in+vi%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F&amp;bm_description=How+to+show+perl%2FC+program+files+in+colors+in+vi%3F" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F&amp;T=How+to+show+perl%2FC+program+files+in+colors+in+vi%3F" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F&amp;title=How+to+show+perl%2FC+program+files+in+colors+in+vi%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F&amp;title=How+to+show+perl%2FC+program+files+in+colors+in+vi%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+How+to+show+perl%2FC+program+files+in+colors+in+vi%3F+@+http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2F1367.de%2F2010%2F11%2F04%2Fhow-to-show-perlc-program-files-in-colors-in-vi%2F&amp;t=How+to+show+perl%2FC+program+files+in+colors+in+vi%3F" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d712').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d712').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://1367.de/2010/11/04/how-to-show-perlc-program-files-in-colors-in-vi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Perl pattern matching between files on two different machines?</title>
		<link>http://1367.de/2010/10/10/perl-pattern-matching-between-files-on-two-different-machines/</link>
		<comments>http://1367.de/2010/10/10/perl-pattern-matching-between-files-on-two-different-machines/#comments</comments>
		<pubDate>Sun, 10 Oct 2010 16:49:33 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[OpenWGA]]></category>
		<category><![CDATA[between]]></category>
		<category><![CDATA[different]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[machines]]></category>
		<category><![CDATA[matching]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[perl]]></category>
		<guid isPermaLink="false">http://1367.de/2010/10/10/perl-pattern-matching-between-files-on-two-different-machines/</guid>
		<description><![CDATA[Question by Doctor_mizo: Perl pattern matching between files on two different machines? Hello&#8230; I have a code which sends another code from one machine(linux) to another(windows) and the sent file have to watch a log file for specific signatures which are written in rules.txt rules.txt in on linux machine and the log file is on [...]]]></description>
			<content:encoded><![CDATA[<p><strong><i>Question by Doctor_mizo</i>: Perl pattern matching between files on two different machines?</strong><br />
Hello&#8230;<br />
I have a code which sends another code from one machine(linux) to another(windows)<br />
and the sent file have to watch a log file for specific signatures which are written in rules.txt<br />
rules.txt in on linux machine<br />
and the log file is on windows machine<br />
how to make the sent agent get the signatures from the file to match them in windows?</p>
<p><strong>Best answer:</strong></p>
<p><i>Answer by Gaytheist Buddha</i><br/>Are you kidding? That&#8217;s a lot of software.</p>
<p><strong>Give your answer to this question below!</strong></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d596').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d596" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F&amp;submitHeadline=Perl+pattern+matching+between+files+on+two+different+machines%3F&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F&amp;title=Perl+pattern+matching+between+files+on+two+different+machines%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F&amp;title=Perl+pattern+matching+between+files+on+two+different+machines%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F&amp;title=Perl+pattern+matching+between+files+on+two+different+machines%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F&amp;bm_description=Perl+pattern+matching+between+files+on+two+different+machines%3F" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F&amp;T=Perl+pattern+matching+between+files+on+two+different+machines%3F" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F&amp;title=Perl+pattern+matching+between+files+on+two+different+machines%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F&amp;title=Perl+pattern+matching+between+files+on+two+different+machines%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Perl+pattern+matching+between+files+on+two+different+machines%3F+@+http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2F1367.de%2F2010%2F10%2F10%2Fperl-pattern-matching-between-files-on-two-different-machines%2F&amp;t=Perl+pattern+matching+between+files+on+two+different+machines%3F" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d596').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d596').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://1367.de/2010/10/10/perl-pattern-matching-between-files-on-two-different-machines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to write a perl script to search text files for a specific string and copy the whole line to a new file?</title>
		<link>http://1367.de/2010/09/20/how-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file/</link>
		<comments>http://1367.de/2010/09/20/how-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 16:50:56 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[OpenWGA]]></category>
		<category><![CDATA[Copy]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[Line]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[specific]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[whole]]></category>
		<category><![CDATA[write]]></category>
		<guid isPermaLink="false">http://1367.de/2010/09/20/how-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file/</guid>
		<description><![CDATA[Question by Travis C: How to write a perl script to search text files for a specific string and copy the whole line to a new file? I have several very large text files (over 1 gb total) that I want to strip out any line that has a specific string, and place that entire [...]]]></description>
			<content:encoded><![CDATA[<p><strong><i>Question by Travis C</i>: How to write a perl script to search text files for a specific string and copy the whole line to a new file?</strong><br />
I have several very large text files (over 1 gb total) that I want to strip out any line that has a specific string, and place that entire line in a text file.  Best case it would open every file in the directory.  Thanks for any pointers (existing websites?)</p>
<p><strong>Best answer:</strong></p>
<p><i>Answer by Michael JB</i><br/>a quicker way than using Perl would be to use grep&#8230;if you have access to it.  It will be on your system if you are using Linux or Unix and is available in Cygwin if you are using windows.  Try this:</p>
<p>grep -h YOUR_KEYWORD_HERE *.txt > results.txt</p>
<p>if you MUST use Perl, the absolute best programming language in the world IMHO, try this:</p>
<p>&#8212;&#8212;&#8211;cut&#8212;&#8212;&#8211;<br />
# this is so we can use English shortcuts like $ARG and such<br />
use English;</p>
<p># open a file to store the results<br />
open (OUTPUT, &#8220;>results.txt&#8221;) || die (&#8220;Could not open file results.txt; $OS_ERROR&#8221;);</p>
<p># read each input file from the command line<br />
# i.e. perl keyword.pl file1.txt file2.txt &#8230;<br />
while (<>) {</p>
<p># if the line has the keyword, print it to the output file<br />
if ($ARG =~ /YOUR_KEYWORD_HERE/) {<br />
print OUTPUT $ARG;<br />
warn &#8220;Found YOUR_KEYWORD_HERE in $ARGV\n&#8221;;<br />
}<br />
}</p>
<p># close the output file<br />
close (OUTPUT);<br />
&#8212;&#8212;&#8211;cut&#8212;&#8212;&#8211;</p>
<p>I&#8217;ll leave it as an exercise for you to figure out which one is faster when dealing with files larger than 1 MB or so.  Also, you might want to do both and then diff the results to see any differences between the two.</p>
<p><strong>Add your own answer in the comments!</strong></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d501').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d501" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F&amp;submitHeadline=How+to+write+a+perl+script+to+search+text+files+for+a+specific+string+and+copy+the+whole+line+to+a+new+file%3F&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F&amp;title=How+to+write+a+perl+script+to+search+text+files+for+a+specific+string+and+copy+the+whole+line+to+a+new+file%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F&amp;title=How+to+write+a+perl+script+to+search+text+files+for+a+specific+string+and+copy+the+whole+line+to+a+new+file%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F&amp;title=How+to+write+a+perl+script+to+search+text+files+for+a+specific+string+and+copy+the+whole+line+to+a+new+file%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F&amp;bm_description=How+to+write+a+perl+script+to+search+text+files+for+a+specific+string+and+copy+the+whole+line+to+a+new+file%3F" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F&amp;T=How+to+write+a+perl+script+to+search+text+files+for+a+specific+string+and+copy+the+whole+line+to+a+new+file%3F" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F&amp;title=How+to+write+a+perl+script+to+search+text+files+for+a+specific+string+and+copy+the+whole+line+to+a+new+file%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F&amp;title=How+to+write+a+perl+script+to+search+text+files+for+a+specific+string+and+copy+the+whole+line+to+a+new+file%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+How+to+write+a+perl+script+to+search+text+files+for+a+specific+string+and+copy+the+whole+line+to+a+new+file%3F+@+http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2F1367.de%2F2010%2F09%2F20%2Fhow-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file%2F&amp;t=How+to+write+a+perl+script+to+search+text+files+for+a+specific+string+and+copy+the+whole+line+to+a+new+file%3F" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d501').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d501').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://1367.de/2010/09/20/how-to-write-a-perl-script-to-search-text-files-for-a-specific-string-and-copy-the-whole-line-to-a-new-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get a sorted list of files by date with perl?</title>
		<link>http://1367.de/2010/09/17/how-to-get-a-sorted-list-of-files-by-date-with-perl/</link>
		<comments>http://1367.de/2010/09/17/how-to-get-a-sorted-list-of-files-by-date-with-perl/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 23:50:30 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[OpenWGA]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[sorted]]></category>
		<guid isPermaLink="false">http://1367.de/2010/09/17/how-to-get-a-sorted-list-of-files-by-date-with-perl/</guid>
		<description><![CDATA[Question by Thee John Galt: How to get a sorted list of files by date with perl? Given a directory, how can I use perl to get an array of files sorted by the date the file was created. Note: I&#8217;m running perl v5.8.8 Best answer: Answer by Dave CardwellUnfortunately many operating systems don’t record [...]]]></description>
			<content:encoded><![CDATA[<p><strong><i>Question by Thee John Galt</i>: How to get a sorted list of files by date with perl?</strong><br />
Given a directory, how can I use perl to get an array of files sorted by the date the file was created.</p>
<p>Note: I&#8217;m running perl v5.8.8</p>
<p><strong>Best answer:</strong></p>
<p><i>Answer by Dave Cardwell</i><br/>Unfortunately many operating systems don’t record a file’s creation time so Perl’s built-in functions can only access the mtime, atime and ctime (last modified, last accessed, last inode change). As I mentioned in the response to your other question, you can use File::CreationTime [1] but that has its own problems.</p>
<p>For the actual sorting, the idiomatic Perl solution is called a Schwartzian Transform [2]. Using -M to get the last modified time, that would be:</p>
<p>my @sorted = map  { $_->[0] }<br />
sort { $b->[1] <=> $a->[1] }<br />
map  { [ $_, -M $_ ] }<br />
glob &#8220;$directory/*&#8221;;</p>
<p>I created an example at http://pastie.caboo.se/97555 to avoid Yahoo! Answers’ dodgy formatting.</p>
<p>Remembering to read that from bottom to top, that&#8217;s: get a list of the files, transform that into a list of their file names and modified time, sort them from oldest to newest, map that back to an array of file names. The best explanation I’ve seen of this was by Mark-Jason Dominus [3]. It’s a very efficient solution.</p>
<p>To use File::CreationTime instead simply replace the “-M $_” with “creation_time($_)”.</p>
<p>Best wishes,<br />
Dave Cardwell.</p>
<p>http://davecardwell.co.uk/perl/</p>
<p><strong>Add your own answer in the comments!</strong></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d488').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d488" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F&amp;submitHeadline=How+to+get+a+sorted+list+of+files+by+date+with+perl%3F&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F&amp;title=How+to+get+a+sorted+list+of+files+by+date+with+perl%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F&amp;title=How+to+get+a+sorted+list+of+files+by+date+with+perl%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F&amp;title=How+to+get+a+sorted+list+of+files+by+date+with+perl%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F&amp;bm_description=How+to+get+a+sorted+list+of+files+by+date+with+perl%3F" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F&amp;T=How+to+get+a+sorted+list+of+files+by+date+with+perl%3F" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F&amp;title=How+to+get+a+sorted+list+of+files+by+date+with+perl%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F&amp;title=How+to+get+a+sorted+list+of+files+by+date+with+perl%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+How+to+get+a+sorted+list+of+files+by+date+with+perl%3F+@+http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2F1367.de%2F2010%2F09%2F17%2Fhow-to-get-a-sorted-list-of-files-by-date-with-perl%2F&amp;t=How+to+get+a+sorted+list+of+files+by+date+with+perl%3F" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d488').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d488').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://1367.de/2010/09/17/how-to-get-a-sorted-list-of-files-by-date-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how do I find all files in a directory using perl?</title>
		<link>http://1367.de/2010/09/07/how-do-i-find-all-files-in-a-directory-using-perl/</link>
		<comments>http://1367.de/2010/09/07/how-do-i-find-all-files-in-a-directory-using-perl/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 23:52:59 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[OpenWGA]]></category>
		<category><![CDATA[Directory]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Using]]></category>
		<guid isPermaLink="false">http://1367.de/2010/09/07/how-do-i-find-all-files-in-a-directory-using-perl/</guid>
		<description><![CDATA[Question by wildmoon: how do I find all files in a directory using perl? I&#8217;m learning Perl and I&#8217;m trying to output all of the files in a directory and find their average sizes. If someone may help me out, I would apprecaite it. Thanks. Best answer: Answer by JohnUse the opendir command: opendir(DIR, &#8220;/usr/john&#8221;) [...]]]></description>
			<content:encoded><![CDATA[<p><strong><i>Question by wildmoon</i>: how do I find all files in a directory using perl?</strong><br />
I&#8217;m learning Perl and I&#8217;m trying to output all of the files in a directory and find their average sizes. If someone may help me out, I would apprecaite it. Thanks.</p>
<p><strong>Best answer:</strong></p>
<p><i>Answer by John</i><br/>Use the opendir command:</p>
<p>opendir(DIR, &#8220;/usr/john&#8221;) or die &#8220;Can&#8217;t open directory!&#8221;;<br />
@files = readdir(DIR);<br />
foreach $file(@files)<br />
{<br />
   @filestats = stat($file);<br />
   $size = $filestats[7];<br />
   printf(&#8220;Filename: s   Size: %d\n&#8221;, $file, $size);<br />
}</p>
<p>Something like that.  Don&#8217;t have perl handy so I can&#8217;t test it but that should be close.</p>
<p><strong>Know better? Leave your own answer in the comments!</strong></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d441').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d441" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F&amp;submitHeadline=how+do+I+find+all+files+in+a+directory+using+perl%3F&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F&amp;title=how+do+I+find+all+files+in+a+directory+using+perl%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F&amp;title=how+do+I+find+all+files+in+a+directory+using+perl%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F&amp;title=how+do+I+find+all+files+in+a+directory+using+perl%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F&amp;bm_description=how+do+I+find+all+files+in+a+directory+using+perl%3F" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F&amp;T=how+do+I+find+all+files+in+a+directory+using+perl%3F" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F&amp;title=how+do+I+find+all+files+in+a+directory+using+perl%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F&amp;title=how+do+I+find+all+files+in+a+directory+using+perl%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+how+do+I+find+all+files+in+a+directory+using+perl%3F+@+http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2F1367.de%2F2010%2F09%2F07%2Fhow-do-i-find-all-files-in-a-directory-using-perl%2F&amp;t=how+do+I+find+all+files+in+a+directory+using+perl%3F" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d441').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d441').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://1367.de/2010/09/07/how-do-i-find-all-files-in-a-directory-using-perl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to list all the duplicate files present in different folders using perl?</title>
		<link>http://1367.de/2010/08/10/how-to-list-all-the-duplicate-files-present-in-different-folders-using-perl/</link>
		<comments>http://1367.de/2010/08/10/how-to-list-all-the-duplicate-files-present-in-different-folders-using-perl/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 10:57:43 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[OpenWGA]]></category>
		<category><![CDATA[different]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[folders]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[present]]></category>
		<category><![CDATA[Using]]></category>
		<guid isPermaLink="false">http://1367.de/2010/08/10/how-to-list-all-the-duplicate-files-present-in-different-folders-using-perl/</guid>
		<description><![CDATA[Question by lali: How to list all the duplicate files present in different folders using perl? Hi, I am new to perl. Pls tell me how to list all the duplicate files present in folders using perl script. Best answer: Answer by martinthurnHere are some hints to get you started. Use opendir and readdir (and [...]]]></description>
			<content:encoded><![CDATA[<p><strong><i>Question by lali</i>: How to list all the duplicate files present in different folders using perl?</strong><br />
Hi,<br />
I am new to perl. Pls tell me how to list all the duplicate files present in folders using perl script.</p>
<p><strong>Best answer:</strong></p>
<p><i>Answer by martinthurn</i><br/>Here are some hints to get you started.</p>
<p>Use opendir and readdir (and closedir) to get a list of files in a folder.<br />
Use a hash to keep track of file names you have seen.</p>
<p><strong>Give your answer to this question below!</strong></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d305').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d305" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F&amp;submitHeadline=How+to+list+all+the+duplicate+files+present+in+different+folders+using+perl%3F&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F&amp;title=How+to+list+all+the+duplicate+files+present+in+different+folders+using+perl%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F&amp;title=How+to+list+all+the+duplicate+files+present+in+different+folders+using+perl%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F&amp;title=How+to+list+all+the+duplicate+files+present+in+different+folders+using+perl%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F&amp;bm_description=How+to+list+all+the+duplicate+files+present+in+different+folders+using+perl%3F" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F&amp;T=How+to+list+all+the+duplicate+files+present+in+different+folders+using+perl%3F" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F&amp;title=How+to+list+all+the+duplicate+files+present+in+different+folders+using+perl%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F&amp;title=How+to+list+all+the+duplicate+files+present+in+different+folders+using+perl%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+How+to+list+all+the+duplicate+files+present+in+different+folders+using+perl%3F+@+http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2F1367.de%2F2010%2F08%2F10%2Fhow-to-list-all-the-duplicate-files-present-in-different-folders-using-perl%2F&amp;t=How+to+list+all+the+duplicate+files+present+in+different+folders+using+perl%3F" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d305').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d305').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://1367.de/2010/08/10/how-to-list-all-the-duplicate-files-present-in-different-folders-using-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Perl and Regular Expressions to Process Html Files &#8211; Part 2</title>
		<link>http://1367.de/2010/08/08/using-perl-and-regular-expressions-to-process-html-files-part-2/</link>
		<comments>http://1367.de/2010/08/08/using-perl-and-regular-expressions-to-process-html-files-part-2/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 08:48:58 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[OpenWGA]]></category>
		<category><![CDATA[Expressions]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Part]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Regular]]></category>
		<category><![CDATA[Using]]></category>
		<guid isPermaLink="false">http://1367.de/2010/08/08/using-perl-and-regular-expressions-to-process-html-files-part-2/</guid>
		<description><![CDATA[Using Perl and Regular Expressions to Process Html Files &#8211; Part 2 In this article we will discuss how to change the contents of an HTML file by running a Perl script on it. The file we are going to process is called file1.htm: Note: To ensure that the code is displayed correctly, in the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Using Perl and Regular Expressions to Process Html Files &#8211; Part 2</strong></p>
<p>In this article we will discuss how to change the contents of an HTML file by running a Perl script on it. </p>
<p>The file we are going to process is called file1.htm:</p>
<p><strong>Note: To ensure that the code is displayed correctly, in the example code shown in this article, square brackets &#8216;[..]&#8216; are used in HTML tags instead of angle brackets &#8221;.</strong></p>
<p>[html]<br />[head][title]Sample HTML File[/title]<br />[link rel="stylesheet" type="text/css" rel="nofollow" onclick="javascript:pageTracker._trackPageview('/outgoing/article_exit_link');" href="style.css"]<br />[/head]<br />[body]<br />[h1]Introduction[/h1]<br />[p]Welcome to the world of Perl and regular expressions[/p]<br />[h2]Programming Languages[/h2]<br />[table border="1" width="400"]<br />[tr][th colspan="2"]Programming Languages[/th][/tr]<br />[tr][td]Language[/td][td]Typical use[/td][/tr]<br />[tr][td]JavaScript[/td][td]Client-side scripts[/td][/tr]<br />[tr][td]Perl[/td][td]Processing HTML files[/td][/tr]<br />[tr][td]PHP[/td][td]Server-side scripts[/td][/tr]<br />[/table]<br />[h1]Summary[/h1]<br />[p]JavaScript, Perl, and PHP are all interpreted programming languages.[/p]<br />[/body]<br />[/html]</p>
<p>Imagine that we need to change both occurrences of [h1]heading[/h1] to [h1 class="big"]heading[/h1]. Not a big change and something that could be easily done manually or by doing a simple search and replace. But we&#8217;re just getting started here.</p>
<p>To do this, we could use the following Perl script (script1.pl):</p>
<p>1 open (IN, &#8220;file1.htm&#8221;);<br />2 open (OUT, &#8220;&gt;new_file1.htm&#8221;);<br />3 while ($line = [IN]) {<br />4 $line =~ s/[h1]/[h1 class="big"]/;<br />5 (print OUT $line);<br />6 }<br />7 close (IN);<br />8 close (OUT);</p>
<p>Note: You don&#8217;t need to enter the line numbers. I&#8217;ve included them simply so that I can reference individual lines in the script.</p>
<p>Let&#8217;s look at each line of the script.</p>
<p>Line 1<br />In this line file1.htm is opened so that it can be processed by the script. In order to process the file, Perl uses something called a filehandle, which provides a kind of link between the script and the operating system, containing information about the file that is being processed. I&#8217;ve called this &#8220;opening&#8221; filehandle &#8216;IN&#8217;, but I could have used anything within reason. Filehandles are normally in capitals.</p>
<p>Line 2<br />This line creates a new file called &#8216;new_file1.htm&#8217;, which is written to by using another filehandle, OUT. The &#8216;&gt;&#8217; just before the filename indicates that the file will be written to.</p>
<p>Line 3<br />This line sets up a loop in which each line in file1.htm will be examined individually.</p>
<p>Line 4<br />This is the regular expression. It searches for one occurrence of [h1] on each line of file1.htm and, if it finds it, changes it to [h1 class="big"].</p>
<p>Looking at Line 4 in more detail:</p>
<p></p>
<p>$line &#8211; This is a variable that contains a line of text. It gets modified if the substitution is successful.</p>
<p>=~ is called the comparison operator.</p>
<p>s is the substitution operator.</p>
<p>[h1] is what needs to be substituted (replaced).</p>
<p>[h1 class="big"] is what [h1] has to be changed to.</p>
<p>Line 5<br />This line takes the contents of the $line variable and, via the OUT file handle, writes the line to new_file1.htm.</p>
<p>Line 6<br />This line closes the &#8216;while&#8217; loop. The loop is repeated until all the lines in file1.htm have been examined.</p>
<p>Lines 7 and 8<br />These two lines close the two file handles that have been used in the script. If you missed off these two lines the script would still work, but it&#8217;s good programming practice to close file handles, thus freeing up the file handle names so they can be used, for example, by another file.</p>
<p><strong>Running the Script</strong></p>
<p>As the purpose of this article is to explain how to use regular expressions to process HTML files, and not necessarily how to use Perl, I don&#8217;t want to spend too long describing how to run Perl scripts. Suffice to say that you can run them in various ways, for example, from within a text editor such as TextPad, by double-clicking the perl script (script1.pl), or by running the script from an MS-DOS window.</p>
<p>(The location of the Perl interpreter will need to be in your PATH statement so that you can run Perl scripts from any location on your computer and not just from within the directory where the interpreter (perl.exe) itself is installed.)</p>
<p>So, to run our script we could open an MS-DOS window and navigate to the location where the script and the HTML file are located. To keep life simple I&#8217;ve assumed that these two files are in the same folder (or directory). The command to run the script is:</p>
<p>C:&gt;perl script1.pl</p>
<p>If the script does work (and hopefully it will), a new file (new_file1.htm) is created in the same folder as file1.htm. If you open the file you&#8217;ll see the the two lines that contained [h1] tags have been modified so that they now read [h1 class="big"].</p>
<p>In Part 3 we&#8217;ll look at how to handle multiple files.           </p>
<div>
<p>John is a web developer working for <a rel="nofollow" onclick="javascript:pageTracker._trackPageview('/outgoing/article_exit_link');" href="http://www.myquestionsmatter.com">My Health Questions Matter</a>, a company dedicated to helping patients to get the most out of their interaction with health care professionals such as doctors, midwives, and consultants by generating a set of <a rel="nofollow" onclick="javascript:pageTracker._trackPageview('/outgoing/article_exit_link');" href="http://www.myquestionsmatter.com/aboutyou/quick_list_selection.php">health questions</a> a patient can ask at an appointment.</p>
</div>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d295').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d295" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F&amp;submitHeadline=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+2&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F&amp;title=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+2" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F&amp;title=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+2" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F&amp;title=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+2" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F&amp;bm_description=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+2" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F&amp;T=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+2" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F&amp;title=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+2" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F&amp;title=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+2" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+2+@+http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2F1367.de%2F2010%2F08%2F08%2Fusing-perl-and-regular-expressions-to-process-html-files-part-2%2F&amp;t=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+2" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d295').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d295').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://1367.de/2010/08/08/using-perl-and-regular-expressions-to-process-html-files-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Perl and Regular Expressions to Process Html Files &#8211; Part 1</title>
		<link>http://1367.de/2010/08/07/using-perl-and-regular-expressions-to-process-html-files-part-1/</link>
		<comments>http://1367.de/2010/08/07/using-perl-and-regular-expressions-to-process-html-files-part-1/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 17:50:35 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[OpenWGA]]></category>
		<category><![CDATA[Expressions]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Part]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Regular]]></category>
		<category><![CDATA[Using]]></category>
		<guid isPermaLink="false">http://1367.de/2010/08/07/using-perl-and-regular-expressions-to-process-html-files-part-1/</guid>
		<description><![CDATA[Using Perl and Regular Expressions to Process Html Files &#8211; Part 1 Like many web content authors, over the past few years I&#8217;ve had many occasions when I&#8217;ve needed to clean up a bunch of HTML files that have been generated by a word processor or publishing package. Initially, I used to clean up the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Using Perl and Regular Expressions to Process Html Files &#8211; Part 1</strong></p>
<p>Like many web content authors, over the past few years I&#8217;ve had many occasions when I&#8217;ve needed to clean up a bunch of HTML files that have been generated by a word processor or publishing package. Initially, I used to clean up the files manually, opening each one in turn, and making the same set of updates to each one. This works fine when you only have a few files to fix, but when you have hundreds or even thousands to do, you can very quickly be looking at weeks or even months of work. A few years ago someone put me on to the idea of using Perl and regular expressions to perform this &#8216;cleaning up&#8217; process. </p>
<p>Why write an article about Perl and regular expressions I hear you say. Well, that&#8217;s a good point. After all the web is full of tutorials on Perl and regular expressions. What I found though, was that when I was trying to find out how I could process HTML files, I found it difficult to find tutorials that met my criteria. I&#8217;m not saying they don&#8217;t exist, I just couldn&#8217;t find them. Sure, I could find tutorials that explained everything I needed to know about regular expressions, and I could find plenty of tutorials about how to program in Perl, and even how to use regular expressions within Perl scripts. What I couldn&#8217;t find though, was a tutorial that explained how to open one or more HTML or text files, make updates to those files using regular expressions, and then save and close the files.</p>
<p>The Goal</p>
<p>When converting documents into HTML the goal is always to achieve a seamless conversion from the source document (for example, a word processor document) to HTML. The last thing you need is for your content authors to be spending hours, or even days, fixing untidy HTML code after it has been converted.</p>
<p>Many applications offer excellent tools for converting documents to HTML and, in combination with a well designed cascading style sheet (CSS), can often produce perfect results. Sometimes though, there are little bits of HTML code that are a bit messy, normally caused by authors not applying paragraph tags or styles correctly in the source document.</p>
<p>Why Perl?</p>
<p>The reason why Perl is such a good language to use for this task is because it is excellent at processing text files, which let&#8217;s face it, is all HTML files are. Perl is also the de facto standard for the use of regular expressions, which you can use to search for, and replace/change, bits of text or code in a file.</p>
<p>What is Perl?</p>
<p>Perl (Practical Extraction and Report Language) is a general purpose programming language, which means it can be used to do anything that any other programming language can do. Having said that, Perl is very good at doing certain things, and not so good at others. Although you could do it, you wouldn&#8217;t normally develop a user interface in Perl as it would be much easier to use a language like Visual Basic to do this. What Perl is really good at, is processing text. This makes it a great choice for manipulating HTML files.</p>
<p>What is a Regular Expression?</p>
<p>A regular expression is a string that describes or matches a set of strings, according to certain syntax rules. Regular expressions are not unique to Perl &#8211; many languages, including JavaScript and PHP can use them &#8211; but Perl handles them better than any other language.</p>
<p>In part 2, we&#8217;ll look at our first example Perl script</p>
<div>
<p>John Dixon is a web developer working through his own company <a rel="nofollow" onclick="javascript:pageTracker._trackPageview('/outgoing/article_exit_link');" href="http://www.dixondevelopment.co.uk">John Dixon Technology</a>. As well as providing web development services, John&#8217;s company also provides <a rel="nofollow" onclick="javascript:pageTracker._trackPageview('/outgoing/article_exit_link');" href="http://www.dixondevelopment.co.uk/earningstracker.htm">free open source accounting software</a> written in PHP and MySQL.</p>
</div>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d292').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d292" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F&amp;submitHeadline=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+1&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F&amp;title=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+1" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F&amp;title=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+1" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F&amp;title=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+1" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F&amp;bm_description=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+1" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F&amp;T=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+1" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F&amp;title=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+1" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F&amp;title=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+1" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+1+@+http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2F1367.de%2F2010%2F08%2F07%2Fusing-perl-and-regular-expressions-to-process-html-files-part-1%2F&amp;t=Using+Perl+and+Regular+Expressions+to+Process+Html+Files+%26%238211%3B+Part+1" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d292').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d292').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://1367.de/2010/08/07/using-perl-and-regular-expressions-to-process-html-files-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I get an error when I try to install files on Ubuntu from Synaptic Package Manager.?</title>
		<link>http://1367.de/2010/07/18/i-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager/</link>
		<comments>http://1367.de/2010/07/18/i-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 23:05:52 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[OpenWGA]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[from]]></category>
		<category><![CDATA[Install]]></category>
		<category><![CDATA[Manager.]]></category>
		<category><![CDATA[Package]]></category>
		<category><![CDATA[Synaptic]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<guid isPermaLink="false">http://1367.de/2010/07/18/i-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager/</guid>
		<description><![CDATA[Question by Jeb: I get an error when I try to install files on Ubuntu from Synaptic Package Manager.? The error says: E: clamav-base: subprocess post-installation script returned error exit status 1 E: clamav-freshclam: dependency problems &#8211; leaving unconfigured E: clamav: dependency problems &#8211; leaving unconfigured How can I resolve this error? Best answer: Answer [...]]]></description>
			<content:encoded><![CDATA[<p><strong><i>Question by Jeb</i>: I get an error when I try to install files on Ubuntu from Synaptic Package Manager.?</strong><br />
The error says: E: clamav-base: subprocess post-installation script returned error exit status 1<br />
E: clamav-freshclam: dependency problems &#8211; leaving unconfigured<br />
E: clamav: dependency problems &#8211; leaving unconfigured</p>
<p>How can I resolve this error?</p>
<p><strong>Best answer:</strong></p>
<p><i>Answer by vish</i><br/>some of your dependencies are missing, refer to ubuntuforums.org or ubuntu documentation for help, or clamav&#8217;s documentation on how to install</p>
<p><strong>Give your answer to this question below!</strong></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d241').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d241" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F&amp;submitHeadline=I+get+an+error+when+I+try+to+install+files+on+Ubuntu+from+Synaptic+Package+Manager.%3F&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F&amp;title=I+get+an+error+when+I+try+to+install+files+on+Ubuntu+from+Synaptic+Package+Manager.%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F&amp;title=I+get+an+error+when+I+try+to+install+files+on+Ubuntu+from+Synaptic+Package+Manager.%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F&amp;title=I+get+an+error+when+I+try+to+install+files+on+Ubuntu+from+Synaptic+Package+Manager.%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F&amp;bm_description=I+get+an+error+when+I+try+to+install+files+on+Ubuntu+from+Synaptic+Package+Manager.%3F" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F&amp;T=I+get+an+error+when+I+try+to+install+files+on+Ubuntu+from+Synaptic+Package+Manager.%3F" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F&amp;title=I+get+an+error+when+I+try+to+install+files+on+Ubuntu+from+Synaptic+Package+Manager.%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F&amp;title=I+get+an+error+when+I+try+to+install+files+on+Ubuntu+from+Synaptic+Package+Manager.%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+I+get+an+error+when+I+try+to+install+files+on+Ubuntu+from+Synaptic+Package+Manager.%3F+@+http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2F1367.de%2F2010%2F07%2F18%2Fi-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager%2F&amp;t=I+get+an+error+when+I+try+to+install+files+on+Ubuntu+from+Synaptic+Package+Manager.%3F" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://1367.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d241').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d241').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://1367.de/2010/07/18/i-get-an-error-when-i-try-to-install-files-on-ubuntu-from-synaptic-package-manager/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

