Document toolboxDocument toolbox

Fixing sed on OSx

The version of sed on OSx does not work the same as the one on most linux distros. To install a better sed, use a package management system such as homebrew.

1) make sure homebrew is installed (see Developer-Bootstrap here).

2) install gnu-sed

$ brew install gnu-sed
==> Downloading http://ftpmirror.gnu.org/sed/sed-4.2.1.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gnu-sed/4.2.1 --program-prefix=g
==> make install
/usr/local/Cellar/gnu-sed/4.2.1: 7 files, 312K, built in 50 seconds

3) symlink gsed to sed:

$ which sed
/usr/bin/sed
$ ln -s /usr/local/bin/gsed /usr/local/bin/sed
$ which sed
/usr/local/bin/sed
$ sed
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...
  -n, --quiet, --silent
                 suppress automatic printing of pattern space
  -e script, --expression=script
                 add the script to the commands to be executed
  -f script-file, --file=script-file
                 add the contents of script-file to the commands to be executed
  --follow-symlinks
                 follow symlinks when processing in place
  -i[SUFFIX], --in-place[=SUFFIX]
                 edit files in place (makes backup if extension supplied)
  -l N, --line-length=N
                 specify the desired line-wrap length for the `l' command
  --posix
                 disable all GNU extensions.
  -r, --regexp-extended
                 use extended regular expressions in the script.
  -s, --separate
                 consider files as separate rather than as a single continuous
                 long stream.
  -u, --unbuffered
                 load minimal amounts of data from the input files and flush
                 the output buffers more often
      --help     display this help and exit
      --version  output version information and exit
If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret.  All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
 

4) you may need to restart terminal for the changes to take effect