It doesn't strictly answer the "from the command line" part, but since you say you manually typed out the lists, allow me to present: The Easy and Fast Way to type out your lists, using vim
.
The Long Version
Open up vim
by typing: vim
at the command line.
Enter insert mode by pressing i
. Type the first line: 1|1,
and press <Esc>
to exit insert mode.
Press q
to begin recording a macro, and press x
(arbitrarily) to record the macro into register "x".
Type yy
to copy the current line and p
to paste it. This will also put your cursor at the beginning of the newly pasted line. Then, type <C-a>
(Control-A) to increment the number under the cursor.
Type t,
to move your cursor forward to just before the next comma (which puts it on the second number on the line). Type <C-a>
again to increment this number also.
Type q
to stop recording the macro.
Now all that remains is to play back the macro as many times as you want. We'll say 15, just for demonstration. Type 15@x
and your macro will be replayed 15 times, so your screen will now show your list from 1 to 17. Then if you want more lines, you can just type, for instance, 500@x
.
If you have too many lines, type the letter k
to move up in the file and j
to go down. When you are on the first line to be deleted, you can delete from there to the end of the file by typing dG
.
The Short Version
To generate the list from 1 to 31, open vim
by typing vim<Enter>
at the command prompt, then press the following keys:
i1|1,<Esc>qxyyp<C-a>t,<C-a>q29@x
I'm fully familiar with seq
, tr
, echo
and I understand the various other answers that have been posted. It's my considered opinion that the best tool for this job is vim
, unless you actually need to script the text generation.