leah blogs

July 2013

09jul2013 · Summer of Scripts: f

This script actually isn’t by me, but by Mark J. Dominus. It’s very simple, but I use it often: it simply outputs the n-th field.

% lr -l | f 5
220
10
41
...

Compared to cut -f, it has a few advantages: it can output the last fields (by negative index) and it seperates on arbitrary whitespace (some BSD now have cut -w for this, a great addition).

And, of course, it’s quick to type.

NP: Toxoplasma—Weltverbesserer

Copyright © 2004–2018