------------------------------------------------------------------------ seq: sequence generator ------------------------------------------------------------------------ It may surprise some but it is not uncommon to number lines. UNIX has two tools that meet this need: seq & nl. Here we discuss seq. "seq" generates a sequence of numbers (with syntax similar to a "for" loop) CAUTION: Supposedly seq is not a "standard" tool in Unix/Linux. Use "brew" to install $ seq -s OFS -t lastchar -f FORMAT [first [incr]] last #default first=1, incr=1 #default for first is 1 #if last > first then default incr = +1 #if last < first then default incr = -1 #OFS is the output field separator, default "\n" #lastchar is the ouput record separator (last character added to output) #FORMAT specifies the output format $ seq 3 #same as "seq 1 3" 1 2 3 $ seq 2 4 2 3 4 $ seq 4 2 #descending order 4 3 2 $ seq 4 -1 2 #likely to be robust across platforms $ seq 0 0.5 1 #step size other than unity are possible 0 0.5 1 $ seq -s "," -t "\n" 3 1,2,3, $ seq -s " " -t "\n" 3 1 2 3 You can format the numbers: seq -w 10000 will format all integers to 5 digits (zero fill). You can also use "C" formating e.g. $ seq -f "%02g/03/2016" 31 #generates dates 01/03/2016 02/03/2016 ...