<?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: Script Help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572427#M702722</link>
    <description>That's odd, Kent's awk should work just fine.  Here it is as a one-liner:&lt;BR /&gt;&lt;BR /&gt;awk '/^Register/{dareg=$0}/CASH/{dacash=$0}/CHECK/{print dareg;print dacash;print $0}' &amp;lt; file&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 28 Jun 2005 18:43:30 GMT</pubDate>
    <dc:creator>Stuart Browne</dc:creator>
    <dc:date>2005-06-28T18:43:30Z</dc:date>
    <item>
      <title>Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572422#M702717</link>
      <description>Need help with pattern matching reading from a file.  Trying to use egrep but not sure that is the best option.  &lt;BR /&gt;&lt;BR /&gt;File contents:&lt;BR /&gt;&lt;BR /&gt;Register 6&lt;BR /&gt;CASH 100.00&lt;BR /&gt;CHECK 50.00&lt;BR /&gt;Register 6&lt;BR /&gt;.....other stuff&lt;BR /&gt;Register 7&lt;BR /&gt;CASH 2000.00&lt;BR /&gt;CHECK 10.00&lt;BR /&gt;Register 7&lt;BR /&gt;.....other stuff, etc.&lt;BR /&gt;&lt;BR /&gt;I need my output to be&lt;BR /&gt;Register 6&lt;BR /&gt;CASH 100.00&lt;BR /&gt;CHECK 50.00&lt;BR /&gt;&lt;BR /&gt;Register 7&lt;BR /&gt;CASH 2000.00&lt;BR /&gt;CHECK 10.00&lt;BR /&gt;&lt;BR /&gt;Any advice on the best utility to use?</description>
      <pubDate>Tue, 28 Jun 2005 12:42:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572422#M702717</guid>
      <dc:creator>Shannon_1</dc:creator>
      <dc:date>2005-06-28T12:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572423#M702718</link>
      <description>grep -i -e "^register" -e "^cash" -e "^check" FILENAME&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry d brown jr</description>
      <pubDate>Tue, 28 Jun 2005 12:48:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572423#M702718</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2005-06-28T12:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572424#M702719</link>
      <description>So I'm assuming that you only want to print a register name when you get to a cash and check line.&lt;BR /&gt;&lt;BR /&gt;Create a script in a file called useme.awk :&lt;BR /&gt;&lt;BR /&gt;/^Register/ {dareg=$0}&lt;BR /&gt;/CASH/ {dacash=$0}&lt;BR /&gt;/CHECK/ {print dareg; print dacash; print $0}&lt;BR /&gt;&lt;BR /&gt;Run the script like this:&lt;BR /&gt;&lt;BR /&gt;awk -f useme.awk &amp;lt; inputfile &amp;gt; outputfile&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Kent M. Ostby&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Jun 2005 12:53:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572424#M702719</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2005-06-28T12:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572425#M702720</link>
      <description>Shannon,&lt;BR /&gt;&lt;BR /&gt;Are you trying to display the sum of the amounts (cash or check) at the different registers? I'm not sure from your posting; could you clarify.&lt;BR /&gt;&lt;BR /&gt;cheers!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Jun 2005 15:30:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572425#M702720</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-06-28T15:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572426#M702721</link>
      <description>Actually I am not trying to display the sum necessarily but just the register number&lt;BR /&gt;and the cash and check amounts under the register number.  The register numbers are listed twice in the file as well as some other garbage that i don't need.  So I want the output to be something like&lt;BR /&gt;&lt;BR /&gt;Register 6&lt;BR /&gt;CASH 100.00&lt;BR /&gt;CHECK 50.00&lt;BR /&gt;&lt;BR /&gt;Register 7&lt;BR /&gt;CASH 2000.00&lt;BR /&gt;CHECK 10.00&lt;BR /&gt;&lt;BR /&gt;With the register number and then the corresponding cash and check amounts.  &lt;BR /&gt;&lt;BR /&gt;Thanks for any help.  I tried the other two suggestions.  Couldn't get the grep to work and the awk script did not print register numbers but only amounts.</description>
      <pubDate>Tue, 28 Jun 2005 16:13:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572426#M702721</guid>
      <dc:creator>Shannon_1</dc:creator>
      <dc:date>2005-06-28T16:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572427#M702722</link>
      <description>That's odd, Kent's awk should work just fine.  Here it is as a one-liner:&lt;BR /&gt;&lt;BR /&gt;awk '/^Register/{dareg=$0}/CASH/{dacash=$0}/CHECK/{print dareg;print dacash;print $0}' &amp;lt; file&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Jun 2005 18:43:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572427#M702722</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2005-06-28T18:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572428#M702723</link>
      <description>You can get with awk one liner as,&lt;BR /&gt;&lt;BR /&gt;# awk '{ if ( $1 == "Register") { ln1=$0;getline ln2; split(ln2,a," ");if (a[1]=="CASH") { getline ln3; split(ln3,b," ");if (b[1]=="CHECK") { print ln1"\n"ln2"\n"ln3}}} print "\n";}' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;hth.&lt;/FILENAME&gt;</description>
      <pubDate>Wed, 29 Jun 2005 02:00:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3572428#M702723</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-29T02:00:02Z</dc:date>
    </item>
  </channel>
</rss>

