From: William James Date: 2007-09-08T01:25:04+09:00 Subject: Re: read a specific line from a file On Sep 7, 10:30 am, "Robert Klemme" wrote: > 2007/9/7, William James : > > > On Sep 7, 4:50 am, "Robert Klemme" wrote: > > > 2007/9/7, Bulhac Mihai : > > > > > how can i read only a line from a txt file? > > > > for example i want to read only line 3 > > > > sed -ne '3 p' your_file > > > > robert > > > awk "3==NR" your_file > > When I think about it, this is probably more efficient for large files > and low line numbers: > > head -3 your_file | tail -1 awk "3==NR{print;exit}" your_file The rule is: never use anything other than awk unless you have to.