beginning Perl tricks

I've been around in the UNIX world long before Perl made it on the scene. However, I didn't have time to learn it or use it until well after the release of 5.0. I'm just now getting to the point where I'm using Perl as an admin tool... and I'm amazed. I wish I'd forced myself to use it earlier...

example of it's power

PROBLEM: I've obtained my own domain. All of my pages have hard coded references to my isp. This isn't really a problem since I have links in place, but it does add to confusion and will ultimately become a maintenance nightmare. THE FIX NEEDED: Change all instances of "virtual-cafe" to "wagoneers" and all instances of "~john" to "john". SOLUTION: perl -pi -e 's/virtual-cafe/wagoneers/g' *.html perl -pi -e 's/~john/john/g' *.html

use a simple script to fix the pages

While I could write a script to loop through my entire website, I'll simply place this simple script in my script directory (in my path) and execute it each time I enter a directory that hasn't been updated. Crude, but effective. #!/bin/sh # ~/S/FixPages # echo " there were " grep virtual-cafe *.html | wc -l echo " occurrences of virtual-cafe, and replaced with wagoneers " perl -pi -e 's/virtual-cafe/wagoneers/g' *.html echo " there were " grep "~john"~ *.html | wc -l echo " occurrences of ~john, and replaced with john " perl -pi -e 's/~john/john/g' *.html echo "done with this directory
---------------------------------------------
Fundamental Issues
---------------------------------------------
  • the Bible on line
  • What must I do to be saved?
  • Steps to peace with God.
  • BELIEVE THIS!
  • BIBLE passages and books
    ---------------------------------------------
  • So if it's not sunny in Snohomish, where is it SUNNY?

  • winter storm 96/97
  • AMSOIL information
  • Full Size Jeeps
  • downsized Jeeps
  • Diesel Benz info
  • wagoneers.com
  • more UNIX pages on wagoneers.com