Re: Reading a particular line in a file

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: JD Austin
Date:  
To: plug-discuss
Subject: Re: Reading a particular line in a file
Quoting :

> -To print one line of text:
> sed -n "${INDEX}p" filename
> (where INDEX is the line # or numbers)
>
> George Toft

Thats a great one!

I'm always amazed what can be done using head, tail, grep , sed and awk.

I tried your example and couldnt get it to work, how do you specify INDEX?
I tried
sed -n "${22}p" filename (listed whole file)
sed -n "${cat testfile}p" filename (bad substitution)
sed -n "${22,23,24}p" filename (bad substitution)
sed -n "${22 23 24}p" filename (bad substitution)

This works:
sed -n "22p" filename

JD
>
>
> > Is there a command line argument that lets you grab a particular line from
> > from a text file in Linux or Unix?
> >
> > Thanks,
> >
> > Ben
> >



--
JD Austin
Twin Geckos Technology Services LLC
email:
http://www.twingeckos.com
phone/fax: 480.344.2640





---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss