<?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: Inserting a column with awk in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-a-column-with-awk/m-p/5038987#M432479</link>
    <description>Thanks.  Answered so quickly.</description>
    <pubDate>Mon, 09 Apr 2007 18:10:31 GMT</pubDate>
    <dc:creator>Roberto Castellano P</dc:creator>
    <dc:date>2007-04-09T18:10:31Z</dc:date>
    <item>
      <title>Inserting a column with awk</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-a-column-with-awk/m-p/5038985#M432477</link>
      <description>Hello everybody,&lt;BR /&gt;I want to insert a column in a .txt file, and I been using the command  awk '{print "test" ,$0}' file.txt&lt;BR /&gt;the problem is that "test" is not going to be fix anymore, it is a variable now... so, if I use the command awk '{print $test ,$0}' file.txt it doesn´t work in the way i want..&lt;BR /&gt;Thanks for your help.&lt;BR /&gt;</description>
      <pubDate>Mon, 09 Apr 2007 17:28:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-a-column-with-awk/m-p/5038985#M432477</guid>
      <dc:creator>Roberto Castellano P</dc:creator>
      <dc:date>2007-04-09T17:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting a column with awk</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-a-column-with-awk/m-p/5038986#M432478</link>
      <description>So make it a variable.&lt;BR /&gt;&lt;BR /&gt;Check out : man awk&lt;BR /&gt;Look for -v&lt;BR /&gt;&lt;BR /&gt;awk -v text=$TEXT '{print text, $0}' file .ext&lt;BR /&gt;&lt;BR /&gt;(drop the comma if you need no space)&lt;BR /&gt;&lt;BR /&gt;Also read up on the ENVIRON array in that man page.&lt;BR /&gt;&lt;BR /&gt;Finally, you can use straigh shell substitution, but the escaping of the rest gets tricky:&lt;BR /&gt;&lt;BR /&gt;$ export TEXT=test&lt;BR /&gt;$ awk "{print \"$TEXT\", \$0}" file.ext&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 09 Apr 2007 17:43:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-a-column-with-awk/m-p/5038986#M432478</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-04-09T17:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting a column with awk</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-a-column-with-awk/m-p/5038987#M432479</link>
      <description>Thanks.  Answered so quickly.</description>
      <pubDate>Mon, 09 Apr 2007 18:10:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-a-column-with-awk/m-p/5038987#M432479</guid>
      <dc:creator>Roberto Castellano P</dc:creator>
      <dc:date>2007-04-09T18:10:31Z</dc:date>
    </item>
  </channel>
</rss>

