Thanks for the excellent answers! The suggested methods were: awk '(NR==linenumber){print};{next}' file sed -n '<line>p' file tail +line# | head -1 I'm using the awk suggestion. Thanks for replies from Jesse Rhoads, Joseph Bueno, Bertrand Hutin, Brett Geer, Bob Vickers, Dragi Raos, Randy Schrickel, and Jason Dixon. Vic Engle Dragi Raos wrote: >Then perhaps something probably less CPU intensive: > >head -14 ~/.profile | tail -1 > >(Of course, in my previous example I cut 1 char inserted by pr (tab) too >few; it depends on format passed to pr, anyway...) > >Cheers! > >Bonzi > > >----- Original Message ----- >From: "Vic Engle" <sunmanager@nc.rr.com> >To: "Vic Engle" <sunmanager@nc.rr.com> >Cc: "linuxmanagers" <linuxmanagers@linuxmanagers.org> >Sent: Monday, May 19, 2003 2:06 PM >Subject: Clarification: Script question > > > > >>Just to clarify, >> >>the reason I don't just read the entire file into an array to extract >>data is that the files are very large, >1GB. What I'll need to do is >>read through an error log and as I'm reading through the log, I'll >> >> >need > > >>to pull specific line numbers from the large file so I am just looking >>for the most efficient way do that. >> >>Vic >> >> >>Vic Engle wrote: >> >> >> >>>Hello List, >>> >>>I'm trying to figure out how to use perl or a shell to grab a >>> >>> >specific > > >>>line from a text file. The only information I'll have to identify >>> >>> >the > > >>>line is the line number. I know I could open the file and just read >>>down to the line but I was hoping for a shortcut. Any ideas? >>> >>>Thanks, >>> >>> >>> >>-- >>Vic Engle >>Unix Systems Administrator >>Duke Clinical Research >>919-668-8653 >>_______________________________________________ >>LinuxManagers mailing list - http://www.linuxmanagers.org >>submissions: LinuxManagers@linuxmanagers.org >>subscribe/unsubscribe: >> >> >http://www.linuxmanagers.org/mailman/listinfo/linuxmanagers > > > > > > > -- Vic Engle Unix Systems Administrator Duke Clinical Research 919-668-8653 _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Mon May 19 10:47:02 2003
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:11 EST