team$ cat numbers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
team$
team$ cat lines.sh
#!/usr/bin/ksh
echo "Enter No.of lines to remove from TOP : "
read top
echo "Enter No.of lines to remove from BOTTOM :"
read bottom
total=`wc -l < numbers`
endval=`expr $total - $bottom`
startval=`expr $top + 1`
echo "**** Showing lines $startval -- $endval **** \n"
sed -n ${startval},${endval}p $1
team$
team$ lines.sh numbers
Enter No.of lines to remove from TOP :
4
Enter No.of lines to remove from BOTTOM :
4
**** Showing lines 5 -- 11 ****
5
6
7
8
9
10
11
team$
put it in for loop to process all the files .