sumitasok
5/10/2018 - 8:09 AM

see specific lines on tail of large log files

# * 100,000,000-line file generated by seq 100000000 > test.in
# * Reading lines 50,000,000-50,000,010
# * Tests in no particular order
# * real time as reported by bash's builtin time
# https://unix.stackexchange.com/questions/47407/cat-line-x-to-line-y-on-a-huge-file
awk 'NR >= 57890000 && NR <= 57890010' /path/to/file

awk 'NR < 57890000 { next } { print } NR == 57890010 { exit }' /path/to/file

tail -n+50000000 test.in | head -n10

sed -n '50000000,50000010p;57890010q' test.in

head -n50000010 test.in | tail -n10

sed -n '50000000,50000010p' test.in

tail -n50000001 test.in | head -n10

ed -s test.in <<<"50000000,50000010p"

awk 'NR<57890000{next}1;NR==57890010{exit}' test.in

awk 'NR >= 57890000 && NR <= 57890010' test.in