SCRIPT: head

From: Jochen Cichon (jc@versainter.net)
Date: Mon Nov 06 2000 - 13:05:42 CET


OK, I've tested something around mu. And I needed some HEAD command...
But that is only on TCL (which I noticed much later :( )
because I used only the first two disks...
So how to get head...

So i've used awk...

---------- cut here ------------
#!/bin/ash

awk -v max=$2 '
        begin { i=0 }
        { if (i < ((max=="")?10:(max<0)?-1*max:max)) print $0; i++; }' $1
---------- cut here ------------
and it's only 110 Bytes to 635 Bytes :)
And supports...
        awk file # 10 Lines
        awk file 2 # 2 Lines
        awk file -2 # 2 Lines

So have fun...

PS: I like small scripts... for mu

---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk



This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:16 CET