<?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: awk help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803226#M82415</link>
    <description>Something like this?&lt;BR /&gt;&lt;BR /&gt;# perl -ne's/^2\.$ENV{COUNTRY}\.// and print' access.idx | sort -u | sed "s/^/2.$COUNTRY/'&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 10 Sep 2002 13:17:45 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2002-09-10T13:17:45Z</dc:date>
    <item>
      <title>awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803224#M82413</link>
      <description>I have the following trouble with awk command inside of a script file, I'm trying to insert $COUNTRY variable inside of print statement. $COUNTRY always be a numeric value.&lt;BR /&gt;&lt;BR /&gt;cat access.idx|grep ^"2.$COUNTRY."|awk -F"." '{ print $3 }'|sort|uniq -c|awk '{ print "2."$COUNTRY"."$2".*\t"$1 }'&lt;BR /&gt;&lt;BR /&gt;the following error output is displayed:&lt;BR /&gt;awk: Field $() is not correct.&lt;BR /&gt; The input line number is 1.&lt;BR /&gt; The source line number is 1.&lt;BR /&gt;&lt;BR /&gt;I'm trying with "awk -v" argument, but I can not achieve a successfully result.</description>
      <pubDate>Tue, 10 Sep 2002 13:00:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803224#M82413</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2002-09-10T13:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803225#M82414</link>
      <description>Hi Pals,&lt;BR /&gt;&lt;BR /&gt;I have resolved this by:&lt;BR /&gt;cat access.idx|grep ^"2.$COUNTRY."|awk -F"." '{ print $3 }'|sort|uniq -c|awk -v CO=$COUNTRY '{ print "2."CO"."$2".*\t"$1 }'&lt;BR /&gt;&lt;BR /&gt;Thanks anyway</description>
      <pubDate>Tue, 10 Sep 2002 13:15:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803225#M82414</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2002-09-10T13:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803226#M82415</link>
      <description>Something like this?&lt;BR /&gt;&lt;BR /&gt;# perl -ne's/^2\.$ENV{COUNTRY}\.// and print' access.idx | sort -u | sed "s/^/2.$COUNTRY/'&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Sep 2002 13:17:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803226#M82415</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-09-10T13:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803227#M82416</link>
      <description>You could do:&lt;BR /&gt;&lt;BR /&gt;cat access.idx|grep ^"2.$COUNTRY."|awk -F"." '{ print $3 }'|sort|uniq -c|awk x=$COUNTRY '{print "2."x"."$2".*\t"$1 }' &lt;BR /&gt;</description>
      <pubDate>Tue, 10 Sep 2002 13:31:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803227#M82416</guid>
      <dc:creator>Tom Danzig</dc:creator>
      <dc:date>2002-09-10T13:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803228#M82417</link>
      <description>Your problem was in the quote style you use:&lt;BR /&gt;&lt;BR /&gt;awk '{ print "2."$COUNTRY"."$2".*\t"$1 }'&lt;BR /&gt;&lt;BR /&gt;uses single quotes around the scriplet, causing $COUNTRY not to be evaluated as value, but as literal '$COUNTRY', something very unlikely to appear in your access.idx :)&lt;BR /&gt;&lt;BR /&gt;awk '{ print "2."'$COUNTRY'"."$2".*\t"$1 }'&lt;BR /&gt;&lt;BR /&gt;would have done the job to (see the single quotes around $COUNTRY)</description>
      <pubDate>Tue, 10 Sep 2002 13:32:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803228#M82417</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-09-10T13:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803229#M82418</link>
      <description>Change your last awk statement to this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;'{hello=system("echo $COUNTRY");  printf("2. %s.%s.%s",hello,$2,$1); }'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 10 Sep 2002 13:35:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/2803229#M82418</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-09-10T13:35:09Z</dc:date>
    </item>
  </channel>
</rss>

