<?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 in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667177#M931883</link>
    <description>In that case what you need to do is someting like this:&lt;BR /&gt;&lt;BR /&gt;awk { ..... } | read var1 var2 var2&lt;BR /&gt;&lt;BR /&gt;You can get the idea by doing something like this:&lt;BR /&gt;&lt;BR /&gt;echo "XX" "YY" "ZZ" | read var1 var2 var3&lt;BR /&gt;&lt;BR /&gt;$var1 -&amp;gt; XX&lt;BR /&gt;$var2 -&amp;gt; YY&lt;BR /&gt;$var3 -&amp;gt; ZZ&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 19 Feb 2002 15:03:05 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2002-02-19T15:03:05Z</dc:date>
    <item>
      <title>AWK</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667171#M931877</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;  I have one query in AWK..&lt;BR /&gt;&lt;BR /&gt;  I am trying to assign some value to a variable and then trying to access that variable out of awk..&lt;BR /&gt;&lt;BR /&gt;  But then I could not succeed in doing that..&lt;BR /&gt;&lt;BR /&gt;  Say for ex&lt;BR /&gt; &lt;BR /&gt;    $ echo "one two" | awk '{var=$1}'&lt;BR /&gt;&lt;BR /&gt;    $ echo "$var"&lt;BR /&gt; &lt;BR /&gt;  I would like to use the value of variable "VAR" out of awk.&lt;BR /&gt;&lt;BR /&gt;  Is there any way to do it ?&lt;BR /&gt;&lt;BR /&gt;  I checked the awk documentation as well..&lt;BR /&gt;&lt;BR /&gt;  But then could not find what I want..&lt;BR /&gt;&lt;BR /&gt;  So..Can any one pls give me some input on this issue ?&lt;BR /&gt;&lt;BR /&gt;  Thanks&lt;BR /&gt;&lt;BR /&gt;Sundar  &lt;BR /&gt;</description>
      <pubDate>Tue, 19 Feb 2002 09:43:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667171#M931877</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2002-02-19T09:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: AWK</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667172#M931878</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Maybe try :&lt;BR /&gt;&lt;BR /&gt;export var=`echo "one two"       | awk '{print $1}'&lt;BR /&gt;&lt;BR /&gt;echo $var then shows 'one'&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Feb 2002 09:49:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667172#M931878</guid>
      <dc:creator>Corthouts Carlo</dc:creator>
      <dc:date>2002-02-19T09:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: AWK</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667173#M931879</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;first you have to give variables to AWK when using the -v option&lt;BR /&gt;&lt;BR /&gt;awk -v var=value&lt;BR /&gt;&lt;BR /&gt;you can now use the variable in awk- programs.&lt;BR /&gt;&lt;BR /&gt;And you have the possibility to put the output of awk into a variable using command substitution:&lt;BR /&gt;&lt;BR /&gt;var=`cat file |awk '{print $5}'`&lt;BR /&gt;&lt;BR /&gt;after this "trick", you can use var in your scripts.&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Tue, 19 Feb 2002 09:50:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667173#M931879</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-02-19T09:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: AWK</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667174#M931880</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;there is a little typo in Corthouts Carlos script, he forgot to close the backticks for the command substitution.&lt;BR /&gt;&lt;BR /&gt;Additional:&lt;BR /&gt;&lt;BR /&gt;when using a ksh or a POSIX shell you can also use the following syntax:&lt;BR /&gt;&lt;BR /&gt;var=$(command1 | command2 | command3)&lt;BR /&gt;&lt;BR /&gt;this is bad if you use a Bourne shell, which doesn't know this.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Tue, 19 Feb 2002 09:54:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667174#M931880</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-02-19T09:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: AWK</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667175#M931881</link>
      <description>Hi Sundar,&lt;BR /&gt;&lt;BR /&gt;# a=fred&lt;BR /&gt;# echo hello | awk '{print $0,var}' var=$a&lt;BR /&gt;hello fred&lt;BR /&gt;&lt;BR /&gt;should do it for you.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Tue, 19 Feb 2002 10:11:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667175#M931881</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-02-19T10:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: AWK</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667176#M931882</link>
      <description>Friends &amp;amp; Gurus,&lt;BR /&gt;&lt;BR /&gt;   I know there are two possible ways to take out the value from AWK to a variable&lt;BR /&gt;&lt;BR /&gt;   $ var="Value"&lt;BR /&gt;&lt;BR /&gt;   $ awk -v a=$var '{print a}' /tmp/somefile&lt;BR /&gt;&lt;BR /&gt;   But then that is not what I am trying to do..&lt;BR /&gt;&lt;BR /&gt;   We can only pass down the values from Shell to AWK ..&lt;BR /&gt;&lt;BR /&gt;   I am looking out for a way to pass down the value from AWK to SHELL..i.e I will assign some value to a variable inside AWK and then I would like to refer that Variable out of AWK in the SHELL...&lt;BR /&gt;&lt;BR /&gt;   and when it comes to assigning variable a value like this&lt;BR /&gt;&lt;BR /&gt;   $ var=$(awk '{inst}' files)&lt;BR /&gt;&lt;BR /&gt;   I beleive We can assign value to only one variable..&lt;BR /&gt;&lt;BR /&gt;   But I am looking to assign value to MORE THAN one VARIABLE..and then refer that variable out of AWK..&lt;BR /&gt;&lt;BR /&gt;   Hope and wish I am clear and pls let me have some inputs on these things&lt;BR /&gt;&lt;BR /&gt;   Thanks&lt;BR /&gt;&lt;BR /&gt;Sundar&lt;BR /&gt;Sundarhp@hotmail.com</description>
      <pubDate>Tue, 19 Feb 2002 14:53:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667176#M931882</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2002-02-19T14:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: AWK</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667177#M931883</link>
      <description>In that case what you need to do is someting like this:&lt;BR /&gt;&lt;BR /&gt;awk { ..... } | read var1 var2 var2&lt;BR /&gt;&lt;BR /&gt;You can get the idea by doing something like this:&lt;BR /&gt;&lt;BR /&gt;echo "XX" "YY" "ZZ" | read var1 var2 var3&lt;BR /&gt;&lt;BR /&gt;$var1 -&amp;gt; XX&lt;BR /&gt;$var2 -&amp;gt; YY&lt;BR /&gt;$var3 -&amp;gt; ZZ&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Feb 2002 15:03:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667177#M931883</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-02-19T15:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: AWK</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667178#M931884</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;of course you can read several variables the way described by Clay. Or you can redirect the output of the awk- command into a file:&lt;BR /&gt;&lt;BR /&gt;awk '{action}' file &amp;gt; "file_name"&lt;BR /&gt;&lt;BR /&gt;and work with the file after that....&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Feb 2002 15:11:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk/m-p/2667178#M931884</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-02-19T15:11:47Z</dc:date>
    </item>
  </channel>
</rss>

