[X-Unix] Remove last ten lines of files

Kino quinon at rio.odn.ne.jp
Fri Jan 2 04:45:57 PST 2004


On Jan 2, 2004, at 8:04 PM, Kuestner, Bjoern wrote:

> does anybody have a simple solution to remove the last ten lines of 
> files
> (of variable length).

#! /bin/sh

i=`grep -c $ $*`
j=`expr $i - 10`
if [ $j -lt 1 ]; then
j=$i
fi
head -n $j $*


if ... fi would not be necessary, perhaps.


Kino




More information about the X-Unix mailing list