>To: Jim Plank >Subject: Use of $ to reference last line of input stream > >According to the Oreilly book on SED/AWK (p.61) the $ can be used to >reference the last line of the input stream ... i.e. sed -n $p should >print only the last line ... yet this doesn't seem to work on either >SUNOS or SOLARIS ... have you seen it work anywhere? From the lecture notes: You can specify an address by its line number, or as a range of line numbers, separated by a comma. Thus, you specify lines 6 through 10 as ``6,10''. The last line can be specified by the dollar sign. UNIX> sed '2,$d' usopen # delete all but the first line 1 Ernie Els -- -4 -4 0 UNIX> To do your example, you need to have the '$p' in single quotes. Otherwise the shell tries to substitute the binding for the 'p' environment variable. UNIX> sed -n $p usopen p: Undefined variable. UNIX> sed -n '$p' usopen 20 Lee Westwood -- +6 -4 10 UNIX>