<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/language/perl/tags/commandline</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Sat, 25 May 2013 09:15:21 GMT</pubDate>
<item>
<title>(Perl) Renumber the files in a directory, or prefix file names with numbers - noah</title>
<link>http://snipplr.com/view/26527/renumber-the-files-in-a-directory-or-prefix-file-names-with-numbers/</link>
<description><![CDATA[ <p>Useful for renumbering frames to feed into `ffmpeg`</p> ]]></description>
<pubDate>Fri, 15 Jan 2010 16:16:57 GMT</pubDate>
<guid>http://snipplr.com/view/26527/renumber-the-files-in-a-directory-or-prefix-file-names-with-numbers/</guid>
</item>
<item>
<title>(Perl) grep with Perl - noah</title>
<link>http://snipplr.com/view/11878/grep-with-perl/</link>
<description><![CDATA[ <p>A combination of the instructions in the book _Minimal Perl_ and [this Perl one-liners page](http://sial.org/howto/perl/one-liner/)

The general form of the one-liner is:

    > perl -wnl -e '/REGEX/ and print $ARGV." $.: $_"; close ARGV if eof' 

The example below shows how to print the hex colors that are defined in a [Sass](http://haml.hamptoncatlin.com/docs/rdoc/classes/Sass.html) source tree.</p> ]]></description>
<pubDate>Thu, 05 Feb 2009 13:29:59 GMT</pubDate>
<guid>http://snipplr.com/view/11878/grep-with-perl/</guid>
</item>
<item>
<title>(Perl) Rake routes filtering with Perl - noah</title>
<link>http://snipplr.com/view/9570/rake-routes-filtering-with-perl/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 08 Nov 2008 11:29:05 GMT</pubDate>
<guid>http://snipplr.com/view/9570/rake-routes-filtering-with-perl/</guid>
</item>
<item>
<title>(Perl) lwp-request - noah</title>
<link>http://snipplr.com/view/5196/lwprequest/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Mon, 25 Feb 2008 12:28:41 GMT</pubDate>
<guid>http://snipplr.com/view/5196/lwprequest/</guid>
</item>
<item>
<title>(Perl) Generate XHTML on the command line with XML::API::XHTML - noah</title>
<link>http://snipplr.com/view/4971/generate-xhtml-on-the-command-line-with-xmlapixhtml/</link>
<description><![CDATA[ <p>Build a simple XHTML document, format it with Tidy and print the result to "temp.html."

You may first need to `cpan   XML::API::XHTML`, and install Tidy using your favorite package manager, or just [download Tidy by itself](http://tidy.sourceforge.net/#binaries)

### If you can't install XML::API::XHTML

On my system, CPAN complained that "make test had returned bad status" during installation of XML::API::XHTML.  To solve this I started the CPAN shell (just type `cpan`) and then forced the install, like this:
    
    cpan> force XML::API::XHTML</p> ]]></description>
<pubDate>Sun, 10 Feb 2008 02:21:23 GMT</pubDate>
<guid>http://snipplr.com/view/4971/generate-xhtml-on-the-command-line-with-xmlapixhtml/</guid>
</item>
<item>
<title>(Perl) Automated UI test with Selenium-RC, WWW::Selenium and Test::More - noah</title>
<link>http://snipplr.com/view/3707/automated-ui-test-with-seleniumrc-wwwselenium-and-testmore/</link>
<description><![CDATA[ <p>In order for this to work, the Selenium-RC server must be running.

See also the tutorial at http://search.cpan.org/~mschwern/Test-Simple-0.71/lib/Test/Tutorial.pod</p> ]]></description>
<pubDate>Sat, 15 Sep 2007 10:49:16 GMT</pubDate>
<guid>http://snipplr.com/view/3707/automated-ui-test-with-seleniumrc-wwwselenium-and-testmore/</guid>
</item>
<item>
<title>(Perl) search and replace across multiple files with Perl - noah</title>
<link>http://snipplr.com/view/3145/search-and-replace-across-multiple-files-with-perl/</link>
<description><![CDATA[ <p>A couple of useful snippets from an article I found at Perl.com

**Perl search-and-replace on the command line.**

All of these should be usable under Cygwin as well.  But remember that bash wants single-quoted strings but MS-DOS shell wants strings to be double-quoted.</p> ]]></description>
<pubDate>Wed, 04 Jul 2007 20:00:52 GMT</pubDate>
<guid>http://snipplr.com/view/3145/search-and-replace-across-multiple-files-with-perl/</guid>
</item>
<item>
<title>(Perl) Grab linked files from a list of web pages - noah</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) rename - Larry Wall's filename fixer - noah</title>
<link>http://snipplr.com/view/2677/rename--larry-walls-filename-fixer/</link>
<description><![CDATA[ <p>Invoke this script without any arguments to see the help text.  From the Perl Cookbook, Ch. 9.9.</p> ]]></description>
<pubDate>Mon, 21 May 2007 04:49:45 GMT</pubDate>
<guid>http://snipplr.com/view/2677/rename--larry-walls-filename-fixer/</guid>
</item>
</channel>
</rss>