in reply to A little script that combines `head' and `tail' utilities
Or you could just use the toolbox.
$ sed -n 10,20p somefile $ sed -n 40,/foo/p somefile $ sed -n /foo/,/bar/p somefile
Although that's less fun I suppose. Fine, let's do it in Perl.
$ perl -ne'print if 10 .. 20' somefile $ perl -ne'print if 40 .. /foo/' somefile $ perl -ne'print if /foo/ .. /bar/' somefile
Makeshifts last the longest.
|
|---|