Hamilton LaboratoriesHamilton C shell 2012User guide

Awk, perl and vi

Oregon Coast

Awk, perl and vi
Previous | Next

Topics

Free implementations on the web awk
perl
vi
See also

Free implementations on the web

Hamilton C shell does not include awk, perl or vi for the simple reason that there are authoritative, free implementations already available on the net. Here are my recommendations:

awk

Brian Kernighan is the “K” in awk. From his home page at Bell Labs, you'll find a link to The Awk Programming Language page. The latest version of the One True Awk can be downloaded from Brian's mirror at Princeton.

When Brian says this The One, I trust his judgment.

perl

There is still only one root codebase for perl, the one created by Larry Wall. My choice for the best page from which to download the latest source or Windows executable is the O'Reilly page maintained by Tom Christiansen.

vi

Hands down, the best vi ever written is Vim, short for Vi-Improved, by Bram Moolenar. From the Vim home page is a link to the downloads page from which you can download both source and a Windows executable.

Bram hopes that if you find Vim useful, that you’ll make a donation to help needy children in Uganda.

To use Vim under the C shell, it's helpful to invoke it via these aliases, predefined in the default Startup.csh:

alias vim env -D SHELL= vim.exe alias gvim env -D SHELL= gvim.exe

Vim can run external commands, e.g., :!csh to "shell out" to the C shell, or :%!tr a-z A-Z to uppercase everything in the buffer by filtering it through the tr utility. Vim does this by passing the command to cmd.exe.

Unfortunately, if the SHELL environment variable is defined, Vim gets confused. It will use it, but it still expects that it points at cmd.exe and it constructs a command line accordingly, which doesn't work with the C shell. Since you can't delete the SHELL variable from the C shell's environment, these aliases use the env utility as an interlude to delete the SHELL variable from the environment passed to Vim.

See also

Startup.csh
Predefined aliases
SHELL environment variable
env utility
Tutorial: Environment variables
Tutorial: Aliases

Previous | Next