Command-line Utilities

These are meant to be run from the command line on Unix-like systems. So far all of these are Perl scripts (work on 5.8.8 and/or 5.16.2 on Mac OS X, at least), so you can run them like any other Perl program (though they all need arguments); they should also work if set to executable. Many of these are fairly simple, so you could probably find similar things elsewhere. All are less than 3 kilobytes except plgrep.

Contents: base64, http-head, plgrep, perl-repl, thirdperson, uuniq

base64

Encode or decode base 64 text.

Usage: base64 -e|-d [file...]. -e for encode, -d for decode. The option must be specified, and no other options are supported.

Download base64 (source)

http-head

Show the HTTP headers for any given URL.

Usage: http-head url [headers ...]. (No options.)

Updated 2014-08-28: allows specifying additional HTTP headers, one header per argument. E.g., http-head www.example.com 'User-Agent: Mozilla/5.0'

Updated 2014-11-04: fixes a bug that caused it not to work with certain servers

Download http-head (source)

plgrep

Like grep, but uses Perl syntax, since the version of grep that came with my computer doesn't use Perl syntax.

Updated 2016-12-15 (version 3.0.1).

Some differences from normal grep (besides using Perl regular expressions and not supporting all options):

More information (includes help and older versions); Download plgrep (10.85K) (source)

perl-repl

Prompts for Perl commands, then executes them. Other interpreters have this feature built-in, but I couldn't find it for Perl, so I made one. (Stands for Read–eval–print loop.)

Known issues: Currently there's no built-in functionality to start by loading subroutines from a file. The use command still seems to work, though. Also no line editing. Also if the command you type is a print statement, it prints the return value of print (usually 1, indicating success) afterwards.

Updated 2014-06-02: Control-C stops the currently-running command.

Download perl-repl (source)

thirdperson

Not really useful, but may be mildly interesting. Converts first-person text into third-person text.

Download thirdperson (source)

uuniq

Like uniq, but matches lines that are not next to each other.

Usage: uuniq [-cdilu] [-f #] [-c #] [file...]

Download uuniq (source)