remove_first_lines 350 Bytes
Newer Older
Nico Schottelius's avatar
Nico Schottelius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/bin/sh
#
# Nico Schottelius <nico-linux@schottelius.org>
# Date: 15-Sep-2004
# Last Modified: -
#
# Removes the first n lines

if [ $# -ne 2 ]; then
   echo "$0: "'<lines_to_cut> <file>'
   exit 1
fi

CUT_LINES=$1
FILE=$2

LINES=`cat "$FILE" | wc -l`

TAIL_LINES=`echo "${LINES}-${CUT_LINES}" | bc`
echo $TAIL_LINES

tail -n "$TAIL_LINES" "$FILE"