Hello all,
I would like to create a for loop or whatever is quick that will print the one�s place of a number for 1-N times
say for example a printed page formatting is 132 characters wide,
I would like a single line
123456789012345678901234567890... ...012
That is 132 characters long. I am putting this in a simple print test program and want the recipient to see at a glance that the printing is not getting truncated for any reason.
I see in a similar thread a slick way to print a single character N times
In these below cases if one * was missing (due to printer/lp miss configuration) in a string of 132 your eye could miss it easily.. TIA. -KJ
This is a breeze in Perl if you have Tie::Cycle installed. You tie a scalar to this class and provide the list of values to cycle through (1 to 9, 0). Then, whenever you access the scalar, the next element in the list is fetched. It becomes as easy as saying "print 'this' 132 times". 'this' cycles through that list and gets reset automatically.
Without this simple but wonderful module, you may try:
perl -le '$s="1234567890";print $s x (132/10) . substr($s,0,132%10)'
what os is this from? the while loop works perfectly, something in the awk line for me does not... I get this
awk: Field $() is not correct.
The input line number is 1.
The source line number is 1.
awk: Field $() is not correct.
The input line number is 1.
The source line number is 1.
N times. Thank you for your time. -just wondering if my awk has different options. -KJ
---------- Post updated at 04:40 PM ---------- Previous update was at 04:37 PM ----------
This fully works for me right now. You just made my day... in fact you all have thanks for all the Reponses. I now just need to look up how to pass the 132 as a var and i'm toast with this project. -KJ I have not written perl since '98 lol
---------- Post updated at 05:05 PM ---------- Previous update was at 04:40 PM ----------