<?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 help required. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647780#M676944</link>
    <description>x={'/\n/!G;s/\(.\)\(.*\n\)/&amp;amp;\2\1/;//D;s/.//'} ;ps -ef | grep 4444 | grep -v grep |sed $x| awk '{print $3,$2,$1}'|sed $x   #Cheers.</description>
    <pubDate>Tue, 15 Jun 2010 11:36:51 GMT</pubDate>
    <dc:creator>Raj D.</dc:creator>
    <dc:date>2010-06-15T11:36:51Z</dc:date>
    <item>
      <title>awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647777#M676940</link>
      <description>Hello experts,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; ps -ef | grep 4444&lt;BR /&gt; &lt;BR /&gt;weblogic 24185     1  0  Feb 21  ?         0:00 /bin/sh ./startNodeManager.sh rodyserver 4444&lt;BR /&gt;&lt;BR /&gt;From above command I want to capture last three coulmns of the output.&lt;BR /&gt;&lt;BR /&gt;using  awk `{print $NF}`  I can capture only last column. But I need last three columns. Please help ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Jun 2010 10:30:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647777#M676940</guid>
      <dc:creator>Archana1</dc:creator>
      <dc:date>2010-06-15T10:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647778#M676942</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;ps -ef|grep 4444|grep -v grep | awk '{print $10, $11, $12}'&lt;BR /&gt;&lt;BR /&gt;rgs,&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Jun 2010 10:35:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647778#M676942</guid>
      <dc:creator>rariasn</dc:creator>
      <dc:date>2010-06-15T10:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647779#M676943</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# X="weblogic 24185 1 0 Feb 21 ? 0:00 /bin/sh ./startNodeManager.sh rodyserver 4444"&lt;BR /&gt;&lt;BR /&gt;# echo ${X}|awk '/ 4444$/ {print $(NF-2),$(NF-1),$NF}'&lt;BR /&gt;./startNodeManager.sh rodyserver 4444&lt;BR /&gt;&lt;BR /&gt;This also eliminates the 'grep' since 'awk' does the matching too --- here specifically anchored to the end of the line.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Jun 2010 10:43:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647779#M676943</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-15T10:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647780#M676944</link>
      <description>x={'/\n/!G;s/\(.\)\(.*\n\)/&amp;amp;\2\1/;//D;s/.//'} ;ps -ef | grep 4444 | grep -v grep |sed $x| awk '{print $3,$2,$1}'|sed $x   #Cheers.</description>
      <pubDate>Tue, 15 Jun 2010 11:36:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647780#M676944</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2010-06-15T11:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647781#M676946</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Raj:  I'm sorry, but you have to be kidding.  The OP wants to capture the last three columns of the output.  What's so hard about that?&lt;BR /&gt;&lt;BR /&gt;Pipelines where 'grep', 'sed' and 'awk' are mixed together are red-flags for code that begs to be re-worked.  All three filters can perform matching operations.  Why spawn multiple processes when one will suffice?  Why read and write the same data down the pipeline spawning new processes as you go?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 15 Jun 2010 12:00:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647781#M676946</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-15T12:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647782#M676948</link>
      <description>James, &lt;BR /&gt;thanks, seems to be kidding but I am not, &lt;BR /&gt;This is a simple statement but looks complex :) as there is no rev command in hp-ux, else it would have been looked simple: (sed simulating the rev here).&lt;BR /&gt;&lt;BR /&gt;$ ps -ef|grep 4444|rev| awk '{print $3,$2,$1}'|rev &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Btw, question to Archana, &lt;BR /&gt;what is the problem getting 10th/11th &amp;amp; 12th field with awk. ? (Those are last three field).&lt;BR /&gt;&lt;BR /&gt;Also Archana would you mind assigning point at the end? This is not only me, many people has advised the same in many of your thread.!!&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Tue, 15 Jun 2010 12:12:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647782#M676948</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2010-06-15T12:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647783#M676950</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Raj: as there is no rev command in hp-ux, else it would have been looked simple: (sed simulating the rev here).&lt;BR /&gt;&lt;BR /&gt;Yes, and you have to do it *twice* to put the data back into its original order, adding another process and more I/O.&lt;BR /&gt;&lt;BR /&gt;While Linux has 'rev', Perl has 'reverse()':&lt;BR /&gt;&lt;BR /&gt;# X="weblogic 24185 1 0 Feb 21 ? 0:00 /bin/sh ./startNodeManager.sh rodyserver 4444"&lt;BR /&gt;&lt;BR /&gt;# echo $X|perl -nle 'print scalar reverse $_'&lt;BR /&gt;4444 revresydor hs.reganaMedoNtrats/. hs/nib/ 00:0 ? 12 beF 0 1 58142 cigolbew&lt;BR /&gt;&lt;BR /&gt;# echo $X|perl -nle '@a=split;print join " ",reverse @a'&lt;BR /&gt;4444 rodyserver ./startNodeManager.sh /bin/sh 0:00 ? 21 Feb 0 1 24185 weblogic&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 15 Jun 2010 12:32:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647783#M676950</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-15T12:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647784#M676952</link>
      <description>I like the last one using array, thats great, t u again..&lt;BR /&gt;&lt;BR /&gt;(0 pts. for this pls)</description>
      <pubDate>Tue, 15 Jun 2010 14:03:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647784#M676952</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2010-06-15T14:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647785#M676953</link>
      <description>Now Iam looking for an statement that Incase particular entry (red...)  doesn't exists in dynamic log file then write into other log file.&lt;BR /&gt;&lt;BR /&gt;The log file contains :-&lt;BR /&gt;Red&lt;BR /&gt;Yellow&lt;BR /&gt;Green&lt;BR /&gt;&lt;BR /&gt;Pls help out ?</description>
      <pubDate>Wed, 16 Jun 2010 05:56:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647785#M676953</guid>
      <dc:creator>Archana1</dc:creator>
      <dc:date>2010-06-16T05:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647786#M676955</link>
      <description>&lt;BR /&gt;You didn't yet assign the  points to those who helped you on time, and answered with their valuable times here. &lt;BR /&gt;&lt;BR /&gt;I hope you review the threads after posting, Don't you.?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Your Profile says:&lt;BR /&gt;&lt;BR /&gt;" I have assigned points to   17  of   114  responses to my questions. "&lt;BR /&gt;&lt;BR /&gt;- That means you have not appreciated by assigning points to (114-17) = 97 responses and seems you  just dis-respected those answers.  Does that make sense!.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;- Again it is advised to read the Forum rules and courtesy pages before you start posting.&lt;BR /&gt;&lt;BR /&gt;How do I assign points? : &lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How many points should I assign to replies? &lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/helptips.do?#34" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/helptips.do?#34&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Finally: &lt;BR /&gt;Here is how you can assign points to all your thread you have ignored so far:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums13.itrc.hp.com/service/forums/pageList.do?forumId=1&amp;amp;&amp;amp;listType=unassigned&amp;amp;userId=WW286726" target="_blank"&gt;http://forums13.itrc.hp.com/service/forums/pageList.do?forumId=1&amp;amp;&amp;amp;listType=unassigned&amp;amp;userId=WW286726&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The Forums community appreciates your efforts to fairly rate the answers you have received.&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Jun 2010 06:44:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647786#M676955</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2010-06-16T06:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647787#M676957</link>
      <description>HI (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Now Iam looking for an statement that Incase particular entry (red...) doesn't exists in dynamic log file then write into other log file.&lt;BR /&gt;&lt;BR /&gt;I presume that you want the list of filenames in which the token doesn't appear.  One simple way is:&lt;BR /&gt;&lt;BR /&gt;# grep -v red * /dev/null|awk -F: '{print $1}'|sort -u &amp;gt; myresults&lt;BR /&gt;&lt;BR /&gt;...which looks at all files in your current directory that do *not* contain the token "red".  Lines in each file that fail to match are output with the filename and a colon (":") separator before the line content.  We snip out this name and reduce the population to a unique list.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Jun 2010 16:35:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647787#M676957</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-16T16:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647788#M676959</link>
      <description>&lt;!--!*#--&gt;&amp;gt;JRF: I presume that you want the list of filenames in which the token doesn't appear.&lt;BR /&gt;# grep -v red * /dev/null | awk -F: '{print $1}' | sort -u&lt;BR /&gt;&lt;BR /&gt;This isn't going to do that.  It's going to list all files that have lines that don't have red.&lt;BR /&gt;You need something like:&lt;BR /&gt;for file in *; do&lt;BR /&gt;   grep -q -w red $file&lt;BR /&gt;   if [ $? -ne 0 ]; then&lt;BR /&gt;      echo "$file" # no scummy red, nowhere&lt;BR /&gt;   fi&lt;BR /&gt;done &amp;gt; ../myresults&lt;BR /&gt;&lt;BR /&gt;&amp;gt;fail to match are output with the filename and a colon&lt;BR /&gt;&lt;BR /&gt;-l already does that.&lt;BR /&gt;&lt;BR /&gt;If you don't want to invoke grep in a loop, you can use vector methods and do grep -l all all files then use comm(3) with ls(1) to weed out the the reds.</description>
      <pubDate>Thu, 17 Jun 2010 10:39:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647788#M676959</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-06-17T10:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: awk help required.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647789#M676961</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: &amp;gt;JRF: I presume that you want the list of filenames in which the token doesn't appear...This isn't going to do that.&lt;BR /&gt;&lt;BR /&gt;Yes, you are correct of course.  I'm not sure what I was thinking and my quick test was a shambles of rigor :-)&lt;BR /&gt;&lt;BR /&gt;A one-liner might be"&lt;BR /&gt;&lt;BR /&gt;# grep -c -w red *|awk -F: '$2==0 {print $1}'&lt;BR /&gt;&lt;BR /&gt;...which would show the filenames *not* containing the "word" 'red'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 17 Jun 2010 21:05:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help-required/m-p/4647789#M676961</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-17T21:05:19Z</dc:date>
    </item>
  </channel>
</rss>

