Articles Home

Quickie: Data Mining on the Web with Perl

An extremely basic example of grabbing some data

This is a simple web mining script using perl.#!/usr/bin/perluse LWP::Simple;$numPages=$ARGV[0];open OUTPUT,">/home/user/out.html";for($i=1;$i<=$numPages;$i++){print $i."\n";        $content=get("http://coderswasteland.com/node/".$i);        print OUTPUT $content;        print OUTPUT "*****...

perl, quickie, scripting, linux


Quickie: Multiple File Search and Replace

Solution: perl -pi -w -e 's/searchregex/replaceregex/g;' *.fileextension

If you've ever run into the necessity to change the same data over multiple files you know how hard it is to go through each and every file and update it by hand or at best do an indiviual regex on each. Here's how you can make the changes all in on fell swoop.perl -pi -w -e 's/searchregex/replac...

perl, quickie, scripting


Quickie: Strip ^M (Control-M) Characters from Input File with Perl

Command line removal of control characters

For anyone that does file I/O and has to sometimes work with Windows-generated files in Linux, I feel your pain. Windows has these little nuances that sometimes makes our GNU/Linux world a fun place to live. Luckily, PERL has a simple little system in place that allows us to remove control charac...

perl, quickie, scripting