extracting specific lines from a file

hi all,

i searched in unix.com and accquired the following commands for extracting specific lines from a file ..

sed -n '16482,16482p' in.sql > out.sql
awk 'NR>=10&&NR<=20' in.sql > out.sql....

these commands are working fine if i give the line numbers as such .. but if i pass a variable to it the it is not working...

$ echo $start
2
$ echo $stop
4
$  awk 'NR>=$start&&NR<=$stop' log20091004125917Lbuild.470.xml >temp1
$ cat temp1
$ awk 'NR>=2&&NR<=4' log20091004125917Lbuild.470.xml
<cruisecontrol>
  <modifications>
    <modification type="svn">

the command is not throwing any error nor it is giving any output. my server is solaris .. version 5.8

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

awk "NR>=$start&&NR<=$stop" log20091004125917Lbuild.470.xml >temp1

Or

awk 'NR>=start&&NR<=stop' start=$start stop=$stop log20091004125917Lbuild.470.xml >temp1

Jean-Pierre.