<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr - noah</title>
<link>http://snipplr.com/users/noah/language/perl/tags/filter</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Sun, 26 May 2013 15:53:15 GMT</pubDate>
<item>
<title>(Perl) capitalize words</title>
<link>http://snipplr.com/view/3134/capitalize-words/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 03 Jul 2007 22:53:02 GMT</pubDate>
<guid>http://snipplr.com/view/3134/capitalize-words/</guid>
</item>
<item>
<title>(Perl) id3.pl</title>
<link>http://snipplr.com/view/3129/id3pl/</link>
<description><![CDATA[ <p>This script takes a list of directories as its argument. 
  For mp3s that don't have any id3 information, guess      
  the name of the artist and track based on the filename   
  and use the MP3-Info module to insert that guess into    
  the file as id3v1 tags.</p> ]]></description>
<pubDate>Tue, 03 Jul 2007 22:40:18 GMT</pubDate>
<guid>http://snipplr.com/view/3129/id3pl/</guid>
</item>
<item>
<title>(Perl) Truncate filenames but keep file extensions intact</title>
<link>http://snipplr.com/view/3127/truncate-filenames-but-keep-file-extensions-intact/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 03 Jul 2007 22:33:28 GMT</pubDate>
<guid>http://snipplr.com/view/3127/truncate-filenames-but-keep-file-extensions-intact/</guid>
</item>
<item>
<title>(Perl) Grab linked files from a list of web pages</title>
<link>http://snipplr.com/view/3126/grab-linked-files-from-a-list-of-web-pages/</link>
<description><![CDATA[ <p>## how to use

`perl grabit.pl urls_for_download.txt`

Expects as argument the name of a file containing a newline-delimited list of URLs:

    http://example.com/coolstuff
    http://example.com/coolstuff/fun
    http://example.com/videos/explosions

When invoked, launches an interactive shell that asks what type of file should be downloaded.  Then downloads all the files that are linked from each of the listed Web pages.

Note that the location of the download folder is hard-coded to `c:/windows/desktop/grabit/` so you may want to change that before trying.

This script is also [available on Github](http://github.com/textarcana/scrapers/blob/643e6e7cb349fa94cbc3fc88e1d55c7b6a262d11/grabit.pl)

## Wait! Do you know about WGet and Curl?

This script is legacy.  People seem to like it (hey, I still use it) but today I would probably not write my own tool to download multiple files off remote sites.

Instead I would likely just use a command-line Web browser like [WGet](http://lifehacker.com/software/top/geek-to-live--mastering-wget-161202.php 'Gina Trapani of Lifehacker, on the way of the WGet ninja') or Curl.  [LWP-Request would also do the trick](http://snipplr.com/view/4063/download-linked-jpegs-from-a-web-page-on-the-command-line/)

## do not comment your code like this!

For a great explanation of the rather baroque commenting style I was using circa 2001, see [Steve Yegge's excellent article on code style: *Portait of a n00b.*](http://steve-yegge.blogspot.com/2008/02/portrait-of-n00b.html)  

Of course, when I sit down to write a Perl script today, I [use POD](http://snipplr.com/view/18611/perl-pod-embedded-documentation-example/) to format and publish my comments.</p> ]]></description>
<pubDate>Tue, 03 Jul 2007 22:31:30 GMT</pubDate>
<guid>http://snipplr.com/view/3126/grab-linked-files-from-a-list-of-web-pages/</guid>
</item>
<item>
<title>(Perl) Remove duplicate lines from a text file with Perl</title>
<link>http://snipplr.com/view/3124/remove-duplicate-lines-from-a-text-file-with-perl/</link>
<description><![CDATA[ <p>*[Found at Google Answers.](http://answers.google.com/answers/threadview?id=25196)*

Sometimes I get a big list of things, and some of the things occur multiple times in the same list.  To make the list easier to read, I want to *delete* the duplicate lines.
 
A good example is a list of files that have errors (maybe excerpted from an application sever's log files).  In that case you have a newline-delimited list of file paths,  and depending upon the situation, the same file path might be listed 4 or 5 times or more.  Often, it is useful to have a list of just the files that are faulty, which can be produced by deleting all the duplicate lines.  This script is for filtering just those kinds of list files.

[Of course,](http://xkcd.com/378/ "emacs has a command for that")  for **Emacs** users  [there is a much easier way to remove duplicate lines:](http://everything2.com/title/useful%2520emacs%2520lisp%2520functions "useful emacs lisp functions"), if you have `uniq` installed on your system.

`M-x sort-lines RET C-x h M-x shell-command-on-region RET uniq RET`</p> ]]></description>
<pubDate>Tue, 03 Jul 2007 22:06:34 GMT</pubDate>
<guid>http://snipplr.com/view/3124/remove-duplicate-lines-from-a-text-file-with-perl/</guid>
</item>
<item>
<title>(Perl) insert ALT attribute into IMG tags that don't already have ALT attributes</title>
<link>http://snipplr.com/view/3120/insert-alt-attribute-into-img-tags-that-dont-already-have-alt-attributes/</link>
<description><![CDATA[ <p>At one point I wanted to give every image on my site an ALT tag.  I did, with some help from beginners@perl.org.</p> ]]></description>
<pubDate>Tue, 03 Jul 2007 21:43:16 GMT</pubDate>
<guid>http://snipplr.com/view/3120/insert-alt-attribute-into-img-tags-that-dont-already-have-alt-attributes/</guid>
</item>
<item>
<title>(Perl) Examine CSS selectors in JSP files and report on whether they match some patterns</title>
<link>http://snipplr.com/view/3119/examine-css-selectors-in-jsp-files-and-report-on-whether-they-match-some-patterns/</link>
<description><![CDATA[ <p>Processe a directory of JSP source files, looks for regex matches, and reports on the number and location of matches.  For detecting deprecated attributes in XHTML.

Uses Mail::Outlook to send an email.  Requires you to click "ok" each time a notification is sent, but gets around firewalls.</p> ]]></description>
<pubDate>Tue, 03 Jul 2007 21:27:59 GMT</pubDate>
<guid>http://snipplr.com/view/3119/examine-css-selectors-in-jsp-files-and-report-on-whether-they-match-some-patterns/</guid>
</item>
</channel>
</rss>