skip navigation

Shell/Perl Scripts

psgvceddos2unix
stripcomgrepparasortips
xmlstructdirpathdtree
renlccalcvsren
reminderadddescrmeerkat
bindverbyterangecvspod
mbox2maildirnument2ucunbase64
unblankwhereamilspm
indent-comments

This is a collection of scripts that I've written over the years. I find them useful; please use them if you do. All scripts are ©Dominic Mitchell, but are licensed under the BSD license. That is to say that you may use them freely, but don't sue me if they break.


adddescr

Add descriptions to jpeg files. This makes it easy to remember what all those photos are that you've taken. It requires rdjpgcom(1) and wrjpgcom(1) to be installed, but that should be the case on most Linux/BSD systems these days. If not, they come with the jpeg library.


bindver

Shows what version of BIND a nameserver is running.


byterange

Shows a range of bytes from a file. Handy if you don't have information in line numbers.


cal

A version of the standard cal(1) command that takes month names instead of numbers.


cvspod

Pulls out all POD in a set of files (even non perl files) and builds a tree of HTML to match it. This is good for documenting all sorts of things that are capable of having POD inside them (eg: mason components).


cvsren

A small tool to make renaming files in cvs a little bit easier. It's still a bit of a kludge, but that's CVS for you...


dirpath

A simple tool to display the file permissions of a directory all the way up to the root.


dos2unix

Quite possibly the simplest version of this tool to ever exist. It gets rid of carriage returns in files that have been edited on a windows system.


dtree

Displays the directory structure similiar to the DOS tree command.


greppara

This variant grep command searches through paragraphs instead of lines. A paragraph is any sequence of text separated by blank lines.


indent-comments

Outputs the magic comments for emacs and vi that set up indentation the way that you like it.


lspm

Lists all the perl modules that have been installed on top of the base installation.


mbox2maildir

Converts a BSD style mbox into a qmail style Maildir. It just does that, nothing else. Unlike all the other scripts I found which were too inflexible. sigh.


meerkat

A set of tools for using the O'Reilly Meerkat service, view XML-RPC. The main tool will download items, whilst the other three are for viewing auxiliary information. The Perl tools all require the Frontier::RPC perl module to be installed from CPAN. The python tools require the xmlrpclib module to be available (Python 2.2 will have it installed by default).


nument2uc

Converts numeric character references (eg: &163;) into actual utf-8 characters.


psg

As a system administrator, I find myself typing in ps ax | grep foo a great many times in a day. To save myself the keystrokes (and get a prettier result), I wrote the following script to do the same thing.


reminder

Uses the at(1) command to mail reminders to you (or somebody else).


renlc

Renames files to lower case, to avoid more DOS-ish behaviour.


sortips

A few times I've needed to keep a file sorted by IP address, but it appears that there's not an easy way to do it with the standard Unix toolset. This script just sorts by a column of IP addresses. Later, somebody pointed out that I could do "sort -t . -k 1,2n -k 2,3n -k 3,4n -k 4,5n hosts", but I still think this is easier.


stripcom

Strips comments and blank lines out of files. Adjustable comment character...


unbase64

Converts all its arguments into plain ascii from base64.


unblank

Gets rid of multiple blank lines in a file.


vced

I like to keep things under version control, but for making small, frequent changes it can be a pain. This script just automates the 4 or so commands that are required to make the change, check the change and commit the change. Far simpler.


whereami

Returns the hostname or IP address of where you are logged in from.


xmlstruct

Shows the structure of an XML file, without any text. This can be useful for comparing the structures of two files.