Home > Shell Scripts > How do delete the first 90 lines

How do delete the first 90 lines

November 29th, 2005

How do delete the first 90 lines in every HTML file in a directory.

#!/bin/ksh
for i in `ls *.html`
do
LINES="`wc -l $i | awk ‘{print $1}’`"
REMOVE="`expr ${LINES} – 90`"
tail -${REMOVE} $i > /tmp/$i.new
done

Shell Scripts

  1. December 15th, 2005 at 15:43 | #1

    You can collapse the three lines down to one using “awk -e “NR > 90 { print $0 }” > /tmp/$i.new

  1. No trackbacks yet.
Comments are closed.