<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Numbers -&amp;gt; Words for Check Printing in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627293#M726296</link>
    <description>Hi,&lt;BR /&gt;Well ... I was gonna suggest using awk with the sub or gsub function, something like&lt;BR /&gt;echo 9865 | awk '{ gsub(9,"nine "); gsub(8,"eight "); print }'&lt;BR /&gt;&lt;BR /&gt;Which would still leave some problems ...&lt;BR /&gt;but then I read Clay's answer ... and felt &lt;BR /&gt;rather stupid.&lt;BR /&gt;Doug, give him points from me as well ... if &lt;BR /&gt;you would be so kind ...&lt;BR /&gt;&lt;BR /&gt;Tom Geudens</description>
    <pubDate>Fri, 07 Dec 2001 05:49:19 GMT</pubDate>
    <dc:creator>Tom Geudens</dc:creator>
    <dc:date>2001-12-07T05:49:19Z</dc:date>
    <item>
      <title>Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627289#M726292</link>
      <description>Hello Everyone:&lt;BR /&gt;&lt;BR /&gt;Our Finance Department has just purchased a new printer and check forms. Of course, no one in IT was contacted until after the fact. The check format is supposed to be identical to our old form. Of course, now we want some 'minor changes' and we don't have the source code. The vendor wants several thousand dollars for this change and 3 months. I would like to write a filter which grabs the output before sending it to lp. The changes actually aren't all that big except for one that is very difficult for me.  Currently, the amount (on line 24) prints like 9145.50 and then on line 30 like '9145 and 50/100'. We would like the amount to print like '$*******9,145.50'  (with comma's) and 'Nine thousand one hundred fourty-five and 50/100'. I think I can put the comma's in the amounts but the numbers to words conversion has me baffled. The actual format is very simple, each check is 48 lines long and everything except lines 24 and 30 can pass unchanged. The new printer also needs a formfeed every page to trigger the fold and seal operation but that I can do. I've attached a sample file. Any ideas are welcome and points will be given. I'll take anything, awk, C, sed, shell scripts. Please help!!!&lt;BR /&gt;&lt;BR /&gt;Thanks, Doug</description>
      <pubDate>Fri, 07 Dec 2001 01:49:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627289#M726292</guid>
      <dc:creator>Doug Dell</dc:creator>
      <dc:date>2001-12-07T01:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627290#M726293</link>
      <description>Hi Doug:&lt;BR /&gt;&lt;BR /&gt;An interesting problem. I love it when things like that on sprung on me. The good news is that I have a C routine that I have used for over twenty years to do the numbers -&amp;gt; english conversion. &lt;BR /&gt;&lt;BR /&gt;You use it like this:&lt;BR /&gt;&lt;BR /&gt;english_numbers(345.12,s_tmp,60)&lt;BR /&gt;&lt;BR /&gt;That will format the string s_tmp up a maximum of 60 characters like "Three hundred fourty five and 12/100". To be safe, I would declare s_tmp[128] or so. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Have fun, Clay</description>
      <pubDate>Fri, 07 Dec 2001 02:16:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627290#M726293</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-12-07T02:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627291#M726294</link>
      <description>Hi Again Doug:&lt;BR /&gt;&lt;BR /&gt;I don't normally do this but this is an interesting one. I think I can translate that C routine into Perl in under 20 minutes. There is a Perl module that is fairly close but I think I'll translate my C routine. I know the commas and stars will be a piece of cake. I should be able to throw everything together by sometime AM CST. I actually have all the pieces except for the english_numbers I just have to put them together.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Fri, 07 Dec 2001 02:26:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627291#M726294</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-12-07T02:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627292#M726295</link>
      <description>Hi again Doug:&lt;BR /&gt;&lt;BR /&gt;The Perl version was a snap. I think you will be amazed at the execution speed especially when compared to awk. I managed to throw in your formfeeds and commas as well. The commify&lt;BR /&gt;was lifted from an O'Reilly 'Perl Cookbook' example. It illustrates Perl at its best and worst. This guy reverses the string since processing and looking for the decimal is easier; does some in-place editing; and then reverse the string again for output. Believe it or not, that stuff begin to make sense after a bit. You will probably have to play just a little to get the horizontal positioning of the two modified lines correct. Just change the "%50s" in the format string to "%48s" or whatever. Other than that your there. Rather than the thousand of dollars your vendor wanted, I'll settle for a few hundred.&lt;BR /&gt;&lt;BR /&gt;Last note: This guy is a filter so it expects you to feed it with stdin and it simply writes to stdout.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Fri, 07 Dec 2001 03:18:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627292#M726295</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-12-07T03:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627293#M726296</link>
      <description>Hi,&lt;BR /&gt;Well ... I was gonna suggest using awk with the sub or gsub function, something like&lt;BR /&gt;echo 9865 | awk '{ gsub(9,"nine "); gsub(8,"eight "); print }'&lt;BR /&gt;&lt;BR /&gt;Which would still leave some problems ...&lt;BR /&gt;but then I read Clay's answer ... and felt &lt;BR /&gt;rather stupid.&lt;BR /&gt;Doug, give him points from me as well ... if &lt;BR /&gt;you would be so kind ...&lt;BR /&gt;&lt;BR /&gt;Tom Geudens</description>
      <pubDate>Fri, 07 Dec 2001 05:49:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627293#M726296</guid>
      <dc:creator>Tom Geudens</dc:creator>
      <dc:date>2001-12-07T05:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627294#M726297</link>
      <description>I had written one awk script for number to work conversion. It can be enhanced changing "printf" statements to print in format that you need.&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Regards,&lt;BR /&gt;Suhas&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Dec 2001 11:30:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627294#M726297</guid>
      <dc:creator>Suhas_3</dc:creator>
      <dc:date>2001-12-07T11:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627295#M726298</link>
      <description>Wow! You guys are great. Suhas your awk script was good but Clay's perl script ran the first time!!! Tom,  you think you feel rather stupid, I had been staring at this for hours and had gotten nowhere!&lt;BR /&gt;&lt;BR /&gt;Clay, I hate to ask but now they are so pleased with 'my' work that they found this small problem that they just know I can fix. "Doug, can you put the hyphen in fourty-five?" Can you at least give me a hint? Your perl script looks easy but everytime I start trying to put in the hyphens I get lost.&lt;BR /&gt;&lt;BR /&gt;Sorry, it took me so long to assign points. I got started and then couldn't get back in to the Forums.&lt;BR /&gt;&lt;BR /&gt;Again, thanks to all!!! &lt;BR /&gt;Doug</description>
      <pubDate>Fri, 07 Dec 2001 20:32:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627295#M726298</guid>
      <dc:creator>Doug Dell</dc:creator>
      <dc:date>2001-12-07T20:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627296#M726299</link>
      <description>Have you tried putting the hyphens into the section where he declares 'my @tens' so that they read "twenty-", "thirty-", etc.?&lt;BR /&gt;&lt;BR /&gt;I don't know perl, but that would appear to be the place to do it.</description>
      <pubDate>Fri, 07 Dec 2001 20:41:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627296#M726299</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-12-07T20:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627297#M726300</link>
      <description>Hi Doug:&lt;BR /&gt;&lt;BR /&gt;I'm glad you liked it. As for those hyphens, I think that is 'too much sugar for a dime'. I will give you a hint. If you look for /ty / that will get you started but the rules get complex rather quickly. Besides us dumb folks in Mississippi do know nothing about no hyphens nohow. I'm not even sure (and really don't care) if it's "One hundred fourty-four thousand fourty-four and 44/100" or "One hundred fourty four thousand fourty-four and 44/100". Maybe some of them educated folks knows the answer but I sure don't. Anyway, if you (or some other nosey-body) can find the answer then MAYBE I'll think about it. I got me a new Perl module and that's all I care about. You can tell them folk's in the Finance Dept. who worries about them there hyphens to get a life.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Dec 2001 20:48:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627297#M726300</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-12-07T20:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627298#M726301</link>
      <description>Sorry Patrick, thank's for playing but&lt;BR /&gt;"One hundred fourty-five" gets one but "One hundred fourty" does not. It gets worse if the thousands or millions also are supposed to get them there hyphens (what we call dashes) as well.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Dec 2001 20:58:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627298#M726301</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-12-07T20:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627299#M726302</link>
      <description>Clay,&lt;BR /&gt;&lt;BR /&gt;My experts tell me that 'fourty-five' gets a hyphen each time in the amount string. Please help.&lt;BR /&gt;&lt;BR /&gt;Patrick,&lt;BR /&gt;&lt;BR /&gt;Thanks,  I tried that first but as Clay pointed out that doesn't quite work.&lt;BR /&gt;&lt;BR /&gt;Doug</description>
      <pubDate>Fri, 07 Dec 2001 21:25:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627299#M726302</guid>
      <dc:creator>Doug Dell</dc:creator>
      <dc:date>2001-12-07T21:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627300#M726303</link>
      <description>Okay Doug: &lt;BR /&gt;&lt;BR /&gt;I spent about 10 minutes after work adding your dumb ole hyphens. I probably didn't code this like a real Perl programmer but rather like a C/C++ guy would. The hyphen stuff is commented a bit to help. If was really an easy addition and ran the first time. I have NOT tested it very extensively so I would test it heavily but the logic appears solid.&lt;BR /&gt;&lt;BR /&gt;I'm still waiting for my check and this project is no longer interesting but you can now be a hero to your users.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Sat, 08 Dec 2001 00:45:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627300#M726303</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-12-08T00:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627301#M726304</link>
      <description>Thanks again Clay!!!&lt;BR /&gt;&lt;BR /&gt;I had been working on the fix but as usual I just managed to clobber your code and got lots of syntax errors.  I was writing another subroutine to add the hyphens but you just added it to the same one. Is that better? &lt;BR /&gt;&lt;BR /&gt;P.S. I'm just asking so that I can give you some more points. You really earned these and you have really made me look like a hero. Thanks again to you and to HP for this Forum. It really is the best!!!&lt;BR /&gt;&lt;BR /&gt;Doug</description>
      <pubDate>Sat, 08 Dec 2001 01:05:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627301#M726304</guid>
      <dc:creator>Doug Dell</dc:creator>
      <dc:date>2001-12-08T01:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers -&gt; Words for Check Printing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627302#M726305</link>
      <description>Hi Doug:&lt;BR /&gt;&lt;BR /&gt;I added the hyphen stuff to the same routine because it uses the @tens and @units arrays. If I had created another subroutine, I would have had to move the arrays out to file scope. I like to keep as much within a subroutine as possible to avoid side effects and unintentional use of variables. It my coding style and I'm sticking to it.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Sat, 08 Dec 2001 01:12:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numbers-gt-words-for-check-printing/m-p/2627302#M726305</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-12-08T01:12:41Z</dc:date>
    </item>
  </channel>
</rss>

