Thursday, May 02, 2013

Portable, super efficient alternative to seq

Ever missed seq on a non-gnu system (like older Solaris)?

Here's an extremely portable alternative which turns out to be much more efficient too!

yes '' | head -100000 | cat -n

Phil explained that the efficiency is to do with the way that cat does its line numbering (by incrementing the ASCII characters rather than counting numbers and converting them to characters) Thanks Phil!