<?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 not outputting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396514#M200035</link>
    <description>We can use awk's match() to do this too as,&lt;BR /&gt;&lt;BR /&gt;T1=addchgdel&lt;BR /&gt;echo $T1&lt;BR /&gt;T2=add&lt;BR /&gt;echo $T2&lt;BR /&gt;echo "$T1 $T2" | awk '{ print match($1,$2) }'&lt;BR /&gt;if [ $? -ne 0 ] ; then&lt;BR /&gt;echo "hit"&lt;BR /&gt;else&lt;BR /&gt;echo "miss"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;It is too work there.&lt;BR /&gt;&lt;BR /&gt;HTH.</description>
    <pubDate>Fri, 08 Oct 2004 12:30:59 GMT</pubDate>
    <dc:creator>Muthukumar_5</dc:creator>
    <dc:date>2004-10-08T12:30:59Z</dc:date>
    <item>
      <title>awk not outputting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396507#M200028</link>
      <description>I am trying to compare 2 strings in a script two see if the contents of one string is in the other string. For instance, is "cd" in "abcdef"?&lt;BR /&gt;&lt;BR /&gt;I settled on the awk 'index' command which appears to be able to return the starting location of the string within the other string. Using the example above with S1 = "abcdef" and S2 = "cd", awk '{index($S1,$S2);}' &lt;BR /&gt;For my purposes a value &amp;gt; 0 would tell me I have a match. Fine.&lt;BR /&gt;&lt;BR /&gt;I'm new to awk and have been trying to get the syntax correct. Sometimes Tru64 gives me a syntax error so I know I'm running awk.  The other times I get nothing; the script just stops and I have to Ctrl-C to end it.  The same thing happens when I run the simplest of awk commands (awk '{print "Hello";}' from the command line;  no response so I have to Ctrl-C to get the Tru64 prompt back.&lt;BR /&gt;&lt;BR /&gt;I have searched Tru64 doc, google and the man page and found lots of info but nothing on how to get the results of my awk commands to display or end up in a script variable.&lt;BR /&gt;&lt;BR /&gt;What am I doing wrong?&lt;BR /&gt;&lt;BR /&gt;KS</description>
      <pubDate>Fri, 08 Oct 2004 11:08:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396507#M200028</guid>
      <dc:creator>Keith_107</dc:creator>
      <dc:date>2004-10-08T11:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: awk not outputting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396508#M200029</link>
      <description>Oops! Looks like this is in the HPUX forum. &lt;BR /&gt;&lt;BR /&gt;Can anybody move it to Tru64?&lt;BR /&gt;&lt;BR /&gt;KS</description>
      <pubDate>Fri, 08 Oct 2004 11:10:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396508#M200029</guid>
      <dc:creator>Keith_107</dc:creator>
      <dc:date>2004-10-08T11:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: awk not outputting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396509#M200030</link>
      <description>No need to move, the answer's the same in HP-UX land. Awk variables are only prefixed with '$' if they are positional variables (e.g $1, $2, ...); other user variables are simply S1, S2 so in your case change $S1 ro S1 and awk will love you.&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Oct 2004 11:13:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396509#M200030</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-10-08T11:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: awk not outputting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396510#M200031</link>
      <description>This is in my script:&lt;BR /&gt;T1=addchgdel&lt;BR /&gt;echo $T1&lt;BR /&gt;T2=add&lt;BR /&gt;echo $T2&lt;BR /&gt;awk '{index(T1,T2);}'&lt;BR /&gt;if [ $? -ne 0 ] ; then&lt;BR /&gt;  echo "hit"&lt;BR /&gt;else&lt;BR /&gt;  echo "miss"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;When I run the script it responds:&lt;BR /&gt;addchgdel&lt;BR /&gt;add&lt;BR /&gt;Then it just hangs&lt;BR /&gt;&lt;BR /&gt;Any ideas?</description>
      <pubDate>Fri, 08 Oct 2004 11:30:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396510#M200031</guid>
      <dc:creator>Keith_107</dc:creator>
      <dc:date>2004-10-08T11:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: awk not outputting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396511#M200032</link>
      <description>Your awk in script is waiting for input there.&lt;BR /&gt;You missed to give that,&lt;BR /&gt;&lt;BR /&gt;Try as,&lt;BR /&gt;&lt;BR /&gt;T1=addchgdel&lt;BR /&gt;echo $T1&lt;BR /&gt;T2=add&lt;BR /&gt;echo $T2&lt;BR /&gt;echo "$T1 $T2" | awk '{index(T1,T2);}'&lt;BR /&gt;if [ $? -ne 0 ] ; then&lt;BR /&gt;echo "hit"&lt;BR /&gt;else&lt;BR /&gt;echo "miss"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;It will work there.&lt;BR /&gt;&lt;BR /&gt;HTH.&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Oct 2004 11:35:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396511#M200032</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-10-08T11:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: awk not outputting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396512#M200033</link>
      <description>If you use  Muthukumars approach, you have to change&lt;BR /&gt;..&lt;BR /&gt;echo "$T1 $T2" | awk '{index(T1,T2);}'&lt;BR /&gt;..&lt;BR /&gt;to&lt;BR /&gt;&lt;BR /&gt;echo "$T1 $T2" | awk '{index($1,$1;}'&lt;BR /&gt;&lt;BR /&gt;Another possibility is the match-operator:&lt;BR /&gt;T1=addchgdel&lt;BR /&gt;echo $T1&lt;BR /&gt;T2=add&lt;BR /&gt;echo $T2&lt;BR /&gt;if echo "$T1 $T2" | awk '$2 !~ $1 {exit 1}'&lt;BR /&gt;then echo ok&lt;BR /&gt;else echo not matched&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Oct 2004 12:00:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396512#M200033</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2004-10-08T12:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: awk not outputting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396513#M200034</link>
      <description>OOOPs. sorry, &lt;BR /&gt;&lt;BR /&gt; Try as,&lt;BR /&gt;&lt;BR /&gt;T1=addchgdel&lt;BR /&gt;echo $T1&lt;BR /&gt;T2=add&lt;BR /&gt;echo $T2&lt;BR /&gt;&lt;BR /&gt;echo "$T1 $T2" | awk '{ &lt;BR /&gt;print index($1,$2) }'&lt;BR /&gt;if [ $? -ne 0 ] ; then&lt;BR /&gt;echo "hit"&lt;BR /&gt;else&lt;BR /&gt;echo "miss"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;HTH.</description>
      <pubDate>Fri, 08 Oct 2004 12:20:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396513#M200034</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-10-08T12:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: awk not outputting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396514#M200035</link>
      <description>We can use awk's match() to do this too as,&lt;BR /&gt;&lt;BR /&gt;T1=addchgdel&lt;BR /&gt;echo $T1&lt;BR /&gt;T2=add&lt;BR /&gt;echo $T2&lt;BR /&gt;echo "$T1 $T2" | awk '{ print match($1,$2) }'&lt;BR /&gt;if [ $? -ne 0 ] ; then&lt;BR /&gt;echo "hit"&lt;BR /&gt;else&lt;BR /&gt;echo "miss"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;It is too work there.&lt;BR /&gt;&lt;BR /&gt;HTH.</description>
      <pubDate>Fri, 08 Oct 2004 12:30:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-not-outputting/m-p/3396514#M200035</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-10-08T12:30:59Z</dc:date>
    </item>
  </channel>
</rss>

