To generate a sequence of number we can use seq
seq 1 10
With this it prints 1 to 10 line by line, because by default separator is new line, anyway you can check, do this
seq -s" " 1 10
Doing this it change new line to a single blank space.
But that is the usage of the this seq ? Let me give an usage example.
Let say I have few text files, all these text files contain lines of book name. All those books name is kept in separate files base on the year published. So 1990.txt contains books published at year 1990.
Now I want to calculate how many books I have in year 1990 to 1998, what should I do ?
cat `seq -f "%g.txt" -s" " 1990 1998` | wc -l
-f is to specified the format of each generated numbers, it works like printf in c. wc -l is to count the lines. I cat all files from 1990.txt til 1998.txt and pass it to count the lines, with that I successfully count all the books.