Hi,
Here's a rough example using sed:
Code:
#!/bin/bash
STARTAT=$1
INFILE="infile"
OUTFILE="output"
sed -n ''$STARTAT',$p' $INFILE > $OUTFILE
Testrun:
Quote:
$ cat infile
1
2
3
4
5
6
7
8
9
10
$ ./show.selection 7
$ cat output
7
8
9
10
|
A range can be printed by sed as follows:
sed -n 'x,yp' infile ($, as used in the example, is special, this tells sed to print up to and including the last line). To use shell variables inside a sed statement you need to use the correct quoting.
Hope this helps.