<?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: Scripting problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475442#M212469</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;this short one should work:&lt;BR /&gt;&lt;BR /&gt;nawk 'BEGIN {FS=",";while (getline &amp;lt;"appl" == 1) ap[$2]=$1;FS=" "}&lt;BR /&gt;        {if(ap[$1]) $1=$1" "ap[$1]; print}' report&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
    <pubDate>Tue, 01 Feb 2005 05:51:39 GMT</pubDate>
    <dc:creator>Peter Nikitka</dc:creator>
    <dc:date>2005-02-01T05:51:39Z</dc:date>
    <item>
      <title>Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475438#M212465</link>
      <description>Hi All, &lt;BR /&gt;&lt;BR /&gt;I have an issue with my script. I want to insert a line based on application of the server.I have a file called report1 as below :&lt;BR /&gt;#cat report1&lt;BR /&gt;sihp8012      /root/.rhosts       bdhp4262            root           &lt;BR /&gt;sihp8012      /root/.rhosts       bdhp4262.na.pg.com  root          &lt;BR /&gt;sihp8012      /root/.rhosts       sisn8001            root           &lt;BR /&gt;sihp8012      /root/.rhosts       sihp8026.ap.pg.com  root           &lt;BR /&gt;sihp8026      /root/.rhosts       bdhp4337.na.pg.com  root           &lt;BR /&gt;sihp8026      /root/.rhosts       192.44.190.109      root           &lt;BR /&gt;sihp8020      /root/.rhosts       bdhp4337.na.pg.com  root  &lt;BR /&gt;&lt;BR /&gt;and I have a file called appl that contains the application name :&lt;BR /&gt;#cat appl&lt;BR /&gt;oracle,sihp8012&lt;BR /&gt;sap,sihp8026&lt;BR /&gt;web,sihp8020&lt;BR /&gt;&lt;BR /&gt;I want to insert the application name between field1 and field 2 of file report1, so the output will be as below :&lt;BR /&gt;sihp8012     oracle   /root/.rhosts      bdhp4262            root           &lt;BR /&gt;sihp8012     oracle   /root/.rhosts      bdhp4262.na.pg.com  root           &lt;BR /&gt;sihp8012     oracle   /root/.rhosts      sisn8001            root           &lt;BR /&gt;sihp8012     oracle   /root/.rhosts      sihp8026.ap.pg.com  root           &lt;BR /&gt;sihp8026     sap      /root/.rhosts      bdhp4337.na.pg.com  root           &lt;BR /&gt;sihp8026     sap      /root/.rhosts      192.44.190.109      root           &lt;BR /&gt;sihp8020     web      /root/.rhosts      bdhp4337.na.pg.com  root           &lt;BR /&gt;&lt;BR /&gt;Anyone can help how to do using shell script? Pls help. High score will be given.&lt;BR /&gt;&lt;BR /&gt;Thanks and Best Regards,&lt;BR /&gt;Dewa&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Feb 2005 04:04:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475438#M212465</guid>
      <dc:creator>Dewa Negara_4</dc:creator>
      <dc:date>2005-02-01T04:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475439#M212466</link>
      <description>Hi,&lt;BR /&gt;you can try this rather simple script. Activate it with two parameters: $1=reportfile, $2=applcation_name:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;GEM_IFS=$IFS&lt;BR /&gt;while read appl_name1 two three user_name1&lt;BR /&gt;do&lt;BR /&gt;        IFS=","&lt;BR /&gt;        while read  user_name2 appl_name2&lt;BR /&gt;        do&lt;BR /&gt;                if [ "$appl_name1" = "$appl_name2" ]&lt;BR /&gt;                then&lt;BR /&gt;                        echo "$appl_name1 $user_name2 $two $three $user_name1"&lt;BR /&gt;                        continue&lt;BR /&gt;                fi&lt;BR /&gt;        done &amp;lt;$2&lt;BR /&gt;        IFS=$GEM_IFS&lt;BR /&gt;done &amp;lt;$1&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Tue, 01 Feb 2005 04:40:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475439#M212466</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-02-01T04:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475440#M212467</link>
      <description>cat appl|tr "," " " &amp;gt; /tmp/appl$$&lt;BR /&gt;for node in `cat /tmp/appl$$|awk '{print $2}'`&lt;BR /&gt;do&lt;BR /&gt;  appl=`grep $node /tmp/appl$$|cut -f1`&lt;BR /&gt;  cat report |sed "s;$node;$node $appl;g" &amp;gt;&amp;gt; /tmp/output&lt;BR /&gt;done&lt;BR /&gt;rm /tmp/appl$$&lt;BR /&gt;&lt;BR /&gt;I hv'nt tested it , the order of report may get changed..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Tue, 01 Feb 2005 04:42:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475440#M212467</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2005-02-01T04:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475441#M212468</link>
      <description>This works:&lt;BR /&gt;&lt;BR /&gt;cat report1 | while read a b c d&lt;BR /&gt;do&lt;BR /&gt; echo "$a `grep $a appl | awk -F"," {'print $1'}` $b $c $d"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Have fun - Keith</description>
      <pubDate>Tue, 01 Feb 2005 05:38:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475441#M212468</guid>
      <dc:creator>Keith Bryson</dc:creator>
      <dc:date>2005-02-01T05:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475442#M212469</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;this short one should work:&lt;BR /&gt;&lt;BR /&gt;nawk 'BEGIN {FS=",";while (getline &amp;lt;"appl" == 1) ap[$2]=$1;FS=" "}&lt;BR /&gt;        {if(ap[$1]) $1=$1" "ap[$1]; print}' report&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Tue, 01 Feb 2005 05:51:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475442#M212469</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2005-02-01T05:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475443#M212470</link>
      <description>hi dewa,&lt;BR /&gt;&lt;BR /&gt;this is similar as kaps, but with little modified one...&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;for name in `cat appl | awk -F"," {'print $2'}`&lt;BR /&gt;do&lt;BR /&gt;echo $name&lt;BR /&gt;appl=`grep $name appl| awk -F"," {'print $1'}`&lt;BR /&gt;echo $appl&lt;BR /&gt;cat report | grep ^$name |sed "s/$name/$name $appl/g"  &amp;gt;&amp;gt; output&lt;BR /&gt;read&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;suresh</description>
      <pubDate>Tue, 01 Feb 2005 06:12:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475443#M212470</guid>
      <dc:creator>SureshKumar_2</dc:creator>
      <dc:date>2005-02-01T06:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475444#M212471</link>
      <description>Hi All, &lt;BR /&gt;&lt;BR /&gt;Thanks alot for your great help. &lt;BR /&gt;&lt;BR /&gt;It should be fine now. I tested the script and it was working well. &lt;BR /&gt;&lt;BR /&gt;Thanks again. &lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Dewa</description>
      <pubDate>Tue, 01 Feb 2005 06:31:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475444#M212471</guid>
      <dc:creator>Dewa Negara_4</dc:creator>
      <dc:date>2005-02-01T06:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475445#M212472</link>
      <description>Dewa,&lt;BR /&gt;if you can change the format of appl to:&lt;BR /&gt;s/^sihp8012 /sihp8012 oracle /&lt;BR /&gt;s/^sihp8026 /sihp8026 sap /&lt;BR /&gt;s/^sihp8020 /sihp8020 web /&lt;BR /&gt;then you can use the command:&lt;BR /&gt;sed -f appl report1 &amp;gt; report2&lt;BR /&gt;Regards,&lt;BR /&gt;Pete</description>
      <pubDate>Tue, 01 Feb 2005 06:34:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-problem/m-p/3475445#M212472</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-02-01T06:34:42Z</dc:date>
    </item>
  </channel>
</rss>

