A selection of Nick's scripts

Most of these scripts work just fine on most UNIX flavors, including Apple's OS X. They were developed and tested mainly under linux, with not-too-old versions of perl and python. Most scripts provide help and list their available options when invoked with the -h option. None of them is especially smart (and, by sufficiently bad abuse, most of them can corrupt/destroy your data...), but a few friends and students find them useful.

Data-oriented scripts

Tools to analyze/manipulate .xyz files

Latex-oriented scripts

Students should also check useful instructions on how to produce good pdf with LaTeX, and Common Errors in Technical Writing.

Pictures/photography-oriented scripts

Instructions for unix newbies

To use these scripts...
  1. fire up a command-line terminal;
  2. create the appropriate folder [mkdir $HOME/bin] (in case it already exist, no worry, you get an error message, but can do no harm);
  3. save the script "scriptname" in there, or save it wherever your browser wants and then move it in there, e.g. [mv ~/Downloads/scriptname ~/bin]. NB! never use cut&paste from the browser screen to download any script: use the browser "Save As" function under "File"!
  4. let your computer know it is executable [chmod +x ~/bin/scriptname].

Hopefully, after your next login "scriptname" becomes a legitimate command, exactly like ls or cp, whatever the folder you are currently working in. If it does not, you need to fix your path, typically by adding an instruction to your file ~/.bashrc
The simplest way to add this instruction is executing the command echo '\nPATH=$HOME/bin:$PATH' >> $HOME/.bashrc . (Please execute this command once only: repeated executions of this line produce a dumb sequence of contradictory lines at the end of "$HOME/.bashrc". In case you accidentally created them, please edit that file and keep only one line PATH=$HOME/bin:$PATH.) After your next login your "scriptname" should execute fine from the command line.

Whenever it makes sense, these scripts throw their output to stdout, i.e. output appears in the terminal window. Their normal use is therefore
scriptname [options] inputfile [moreinputfiles] > outputfile
For example:
prunedata file_to_be_pruned.dat > pruned_file.dat

In case you forgot to redirect output with > and your terminal happens to be scrolling zillions of lines, then maybe you'd better press CTRL-C to kill execution, and repeat your command line with an appropriate redirection.

Most script honor the -h option, which provides a list of acceptable command-line options.

A note on redirecting output: command > somefile replaces whatever content was in somefile with the output of command. This may lead to the unwarned irreversible destruction of potentially precious data. If this makes you feel unsafe, then

  1. backup regularly,
  2. test scripts in folders where you keep no precious unduplicated data, and
  3. think twice before pressing enter!

Comments / debugging / patches are welcome!

<separation line>
created: 23 Aug 2002
last modified: 29 May 2017
by Nicola Manini