[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SLUG] Script Help
On Sun, Jul 02, 2000 at 09:47:39AM +1000, Marty wrote:
> > What command(s) can I use to return a specific line within a data file.
> > i.e: I need to return Line 2 of a file to a shell variable for further
> > processing.
>
> you're gonna start another war ;)
Only because you asked for it :)
> head -2 filename | tail -1
awk ' NR==2 { print; exit } '
sed -n -e 2p -e 2q
(read a; read a; echo $a) < filename
perl -ne 'if ($.==2) { print;exit;}' < filename
Yet get the idea... :)
Scott
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to slug-request@nospam.slug.org.au with
unsubscribe in the text