#!/bin/sh for t in $1* do if [ -e $t ] then for u in $t"/Post/*_noheadings" do if [ -e $u ] then rm $u; fi done fi done for t in $1* do if [ -e $t ] then for s in $t/Post/ft-* do if [ -e $s ] then echo $s; u=$(grep -c . $s); u=$[$u-1]; tail -n$u $s > $s"_noheadings"; fi done fi done