On Jun 16, 2010, at 05:37 , Trey Darley wrote:
Say you've got a simple ascii text file, say, 250,000 lines long. Let's say it's a logfile. Suppose that you wanted to access an arbitrary rangeof lines, say, lines 10,000 - 13,000. One way of doing this is:<snip> sed -n 10000,13000p foobar.txt </snip> Trouble is, the target systems I need to exec this on are ancient anddon't take very kindly to the io hammering this delivers. Can you suggesta better way of achieving this?
tail +10000 foobar.txt | sed 3000q # salt head/tail with -n as posixly tail +10000 foobar.txt | head -3000 # appropriate Many commercial u*ixen have "bfs" which is optimized for large files. echo 10000,13000p | bfs - foobar.txt -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
PGP.sig
Description: This is a digitally signed message part
_______________________________________________ Discuss mailing list Discuss@lopsa.org http://lopsa.org/cgi-bin/mailman/listinfo/discuss This list provided by the League of Professional System Administrators http://lopsa.org/