Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the command line to generate a comma-separated list of numbers 1

Status
Not open for further replies.

bazil2

Technical User
Feb 15, 2010
148
0
0
DE
(elementary user)

My goal is to generate a list of numbers from 1-6000 with an increment of 1 and for each value to be separated by a comma, e.g., 1,2,3, ... 5999,6000

Is it possible to do this in a command shell or to maybe output to this to a .txt file using the '>' function?

Many thanks
 
Hi

Code:
[blue]master #[/blue] printf '%d,' {1..10}
1,2,3,4,5,6,7,8,9,10,

[gray]# or[/gray]

[blue]master #[/blue] seq -s ',' 10
1,2,3,4,5,6,7,8,9,10
The brace expansion with sequence requires Bash or Zsh, [tt]seq[/tt] is part of the GNU coreutils package, so mostly available only on Linux.


Feherke.
feherke.github.io
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top