Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yep. Need line 123425938039 of a gigantic file? [0]

    sed -e 'NR == 123425938039 { print; exit; }' < file
Fast as hell and takes no memory to speak of. Google 'awesome awk' for goodies.

[0]: Yes, this happens.



Wouldn't it be slightly easier to do something like

    sed -n 123425938039p file?
To be fair, this one won't exit early.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: