Perl script: HtmlAsText.pl to convert HTML content into Text File format

This program is to illustrate how tools like HtmlAsText usually work. [code language=”perl”] #! perl #=============================================================================== # Objective: # ———- # # Script to convert HTML File content into Text File # # # $Header: $ #=============================================================================== # Include Modules #=============================================================================== use strict; use warnings; use Pod::Usage; use LWP::Simple; use File::Basename; use HTML::Table; use Alvis::HTML; use HTML::TableExtract qw(tree); use Getopt::Long qw(:config no_ignore_case bundling); #=============================================================================== # Global Variables Declaration #=============================================================================== use vars qw($DEBUG $SRC_FLDR $DEST_FLDR $HTML_TBL_OBJ $ALVIS_HTML_OBJ); #=============================================================================== # Prototypes Section #=============================================================================== sub DoAction; sub My_Readdir; sub InitGlobals; sub ProcessArgs; sub Info {my ($mesg) = @_; print STDOUT "INFO: $mesg\n";} sub […]

Read more

Bash Shell Script: Command Line Foreach Loop

A quick code to demonstrate how you can make use of shell script foreach loop in command line to run any command repeatedly. [code language=”bash”] gunnalag@gmd:/u/gunnalag> foreach user ( `cat my-users.txt` ) foreach? ypmatch $user passwd >> my-users-ypmatch.txt foreach? end Can’t match key user9 in map passwd.byname. Reason: no such key in map. Can’t match key root in map passwd.byname. Reason: no such key in map. gunnalag@gmd:/u/gunnalag> [/code]

Read more