tag:blogger.com,1999:blog-5387140.post7829480189068837623..comments2023-05-19T08:18:22.757-05:00Comments on Zach Bonham: NumberGeneratorZach Bonhamhttp://www.blogger.com/profile/02789394374010279510noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-5387140.post-15333350895950464852007-07-03T22:30:00.000-05:002007-07-03T22:30:00.000-05:00Uh oh, your "postfix" parameter isn't documented! ...Uh oh, your "postfix" parameter isn't documented! :)<BR/><BR/>GNU's coreutils have the "seq" program for generating sequences:<BR/><BR/>% seq --format "CWTEST%020g" 1 10<BR/>CWTEST00000000000000000001<BR/>CWTEST00000000000000000002<BR/>CWTEST00000000000000000003<BR/>CWTEST00000000000000000004<BR/>CWTEST00000000000000000005<BR/>CWTEST00000000000000000006<BR/>CWTEST00000000000000000007<BR/>CWTEST00000000000000000008<BR/>CWTEST00000000000000000009<BR/>CWTEST00000000000000000010<BR/><BR/>(integers between 1 and 10)<BR/><BR/>Or to generate for an arbitrary number once, you can do:<BR/><BR/>% seq --format "CWTEST%020g" 13 13<BR/>CWTEST00000000000000000013<BR/><BR/>It also has the flexibility of floating point values:<BR/><BR/>% seq --format "CWTEST%020.3f" 1 .31 2<BR/>CWTEST0000000000000001.000<BR/>CWTEST0000000000000001.310<BR/>CWTEST0000000000000001.620<BR/>CWTEST0000000000000001.930<BR/><BR/>(numbers betweeen 1 and 2 with step size of .31 and three spots after the decimal place)<BR/><BR/>This is all a wrapper for the sprintf() call in C.Anonymousnoreply@blogger.com