<?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: executing a shell command within a awk command. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979390#M419475</link>
    <description>hi,&lt;BR /&gt;&lt;BR /&gt;i guess since $1 for the echo is "" (null string).&lt;BR /&gt;&lt;BR /&gt;then the echo command will look like &lt;BR /&gt;"echo Test [the value pass from awk]"&lt;BR /&gt;&lt;BR /&gt;GOOD LUCK!</description>
    <pubDate>Wed, 17 May 2006 01:54:46 GMT</pubDate>
    <dc:creator>Warren_9</dc:creator>
    <dc:date>2006-05-17T01:54:46Z</dc:date>
    <item>
      <title>executing a shell command within a awk command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979387#M419472</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I am trying to execute a shell command from the awk script. But, It is not getting executed.&lt;BR /&gt;&lt;BR /&gt;This is what I am trying =======&amp;gt;&lt;BR /&gt;&lt;BR /&gt;sliam15:/ # cfsmntadm display sliam15 | awk '/mnt/ { print $1 }'&lt;BR /&gt;/mnt/sdg1/vol1&lt;BR /&gt;/mnt/sdg1/vol2&lt;BR /&gt;/mnt/sdg1/vol3&lt;BR /&gt;/mnt/sdg1/vol4&lt;BR /&gt;/mnt/sdg1/vol5&lt;BR /&gt;/mnt/sdg1/vset1&lt;BR /&gt;&lt;BR /&gt;sliam15:/ # cfsmntadm display sliam15 | awk '/mnt/ { cfsmount $1 }'&lt;BR /&gt;&lt;BR /&gt;Actually, it is not executing command "cfsmount" at all.&lt;BR /&gt;&lt;BR /&gt;************************************************&lt;BR /&gt;I can execute the command mannually &lt;BR /&gt;sliam15:/ # cfsmount /mnt/sdg1/vol1&lt;BR /&gt;  Mounting...&lt;BR /&gt;  [/dev/vx/dsk/sdg1/vol1] mounted successfully at /mnt/sdg1/vol1 on sliam15&lt;BR /&gt;  [/dev/vx/dsk/sdg1/vol1] mounted successfully at /mnt/sdg1/vol1 on sliam16&lt;BR /&gt;*****************************************************&lt;BR /&gt;&lt;BR /&gt;How could I execute it in similar manner?&lt;BR /&gt;&lt;BR /&gt;I know, I can use for loop and then cfsmount one by one. But, I want to know why the command I have given is not working?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; regards,&lt;BR /&gt;Prasad.</description>
      <pubDate>Wed, 17 May 2006 01:15:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979387#M419472</guid>
      <dc:creator>Prasad Joshi</dc:creator>
      <dc:date>2006-05-17T01:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: executing a shell command within a awk command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979388#M419473</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;how about using xargs?&lt;BR /&gt;&lt;BR /&gt;# cfsmntadm display sliam15 | awk '/mnt/ { print $1 }' | xargs -n 1 cfsmount&lt;BR /&gt;&lt;BR /&gt;GOOD LUCK!!</description>
      <pubDate>Wed, 17 May 2006 01:23:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979388#M419473</guid>
      <dc:creator>Warren_9</dc:creator>
      <dc:date>2006-05-17T01:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: executing a shell command within a awk command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979389#M419474</link>
      <description>Thanks Warren,&lt;BR /&gt;That was gr8.&lt;BR /&gt;&lt;BR /&gt;I have one query related to xargs&lt;BR /&gt;&lt;BR /&gt;I wanted to specify some options to the command given with xargs.&lt;BR /&gt;&lt;BR /&gt;I tried this &lt;BR /&gt;&lt;BR /&gt;sliam15:/ # cfsmntadm display sliam15 | awk '/mnt/ { print $1 }' | xargs -n1 echo $1 Test&lt;BR /&gt;Test /mnt/sdg1/vol1&lt;BR /&gt;Test /mnt/sdg1/vol2&lt;BR /&gt;Test /mnt/sdg1/vol3&lt;BR /&gt;Test /mnt/sdg1/vol4&lt;BR /&gt;Test /mnt/sdg1/vol5&lt;BR /&gt;Test /mnt/sdg1/vset1                                                                                                                                       &lt;BR /&gt;&lt;BR /&gt;Not getting why string "Test" is printed first and then the actuall mount point. It should have been printed the other way.&lt;BR /&gt;&lt;BR /&gt;Thanks Again.&lt;BR /&gt;Prasad</description>
      <pubDate>Wed, 17 May 2006 01:44:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979389#M419474</guid>
      <dc:creator>Prasad Joshi</dc:creator>
      <dc:date>2006-05-17T01:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: executing a shell command within a awk command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979390#M419475</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;i guess since $1 for the echo is "" (null string).&lt;BR /&gt;&lt;BR /&gt;then the echo command will look like &lt;BR /&gt;"echo Test [the value pass from awk]"&lt;BR /&gt;&lt;BR /&gt;GOOD LUCK!</description>
      <pubDate>Wed, 17 May 2006 01:54:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979390#M419475</guid>
      <dc:creator>Warren_9</dc:creator>
      <dc:date>2006-05-17T01:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: executing a shell command within a awk command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979391#M419476</link>
      <description>When you are using xargs , the output from the previous piped command will be treated as argument to what follows xargs.&lt;BR /&gt;Thus the actual execution of your echo will be like&lt;BR /&gt;echo $1 TEST /mnt/sdg1/vol1&lt;BR /&gt;echo $1 TEST /mnt/sdg1/vol2&lt;BR /&gt;&lt;BR /&gt;and in this case $1 is null as it has not been set anywhere, hence the output.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ninad&lt;BR /&gt;</description>
      <pubDate>Wed, 17 May 2006 02:40:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979391#M419476</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-05-17T02:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: executing a shell command within a awk command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979392#M419477</link>
      <description>Thanks to all for help.&lt;BR /&gt;&lt;BR /&gt;I found two ways to solve the problem&lt;BR /&gt;&lt;BR /&gt;1. Use xargs.&lt;BR /&gt;cfsmntadm display sliam15 | awk '/mnt/ { print $1 }' | xargs -n 1 cfsmount&lt;BR /&gt;&lt;BR /&gt;2. Use system()&lt;BR /&gt;cfsmntadm display slpam15 | awk '/mnt/ { system ( "cfsumount " $1 ) }'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; regards,&lt;BR /&gt;Prasad</description>
      <pubDate>Wed, 17 May 2006 04:11:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-shell-command-within-a-awk-command/m-p/4979392#M419477</guid>
      <dc:creator>Prasad Joshi</dc:creator>
      <dc:date>2006-05-17T04:11:55Z</dc:date>
    </item>
  </channel>
</rss>

