for i in `seq 1 1000000`
do
echo $i >> count.dat
doneexport n=500000
export m=500100time sed -n -e "$n,${m}p" -e "${m}q" count.dat > bbb.dat
real 0m0.059s
user 0m0.056s
sys 0m0.004stime head -$m count.dat |tail -100 > aaa.dat
real 0m0.046s
user 0m0.022s
sys 0m0.007s
EC2 micro instance
time sed -n -e "$n,${m}p" -e "${m}q" count.dat > bbb.dat
real 0m0.060s
user 0m0.048s
sys 0m0.008stime head -$m count.dat |tail -100 > aaa.dat
real 0m0.038s
user 0m0.012s
sys 0m0.020s
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
追記
巨大な行数でやると使えないレベルにだった。
time head -50000001 count.dat |tail -1
real 0m2.173s
user 0m1.801s
sys 0m1.660s