sed '999995,1000005!d' < my_massive_file
Get two different lines like this:
sed -n '1000000p;2000000{p;q;}' < massive-log-file.log
See also: http://www.commandlinefu.com/commands/view/6043/print-just-line-4-from-a-textfile
sed -n '1000000p' massive-log-file.log
head -n 10000001 | tail -n 2
0.9 sec utime, 2 sec clock timesed -n '10000000,10000001p'
1.7 sec utime, 2.2 sec clock timesed -n '10000000,10000001p;10000002q'
0.9 sec utime, 1.2 sec clock time Otherwise sed will parse until the end, what head|tail doesn't. Overall the time differences seem irrelevant. It's more a question of beauty. :-)