<?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: script problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757071#M71655</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Try with :&lt;BR /&gt;sed 's/M/p/' top2.out&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Fr??d??ric &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 03 Jul 2002 11:38:07 GMT</pubDate>
    <dc:creator>Frederic Sevestre</dc:creator>
    <dc:date>2002-07-03T11:38:07Z</dc:date>
    <item>
      <title>script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757070#M71654</link>
      <description>hello, &lt;BR /&gt;&lt;BR /&gt;i have the following script :&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;set -x&lt;BR /&gt;top 1&amp;gt;top.out&lt;BR /&gt;cat top.out | egrep '^Memory' | awk ' {print $2 " " $4}' &amp;gt; top2.out&lt;BR /&gt;sed 's/M/p' top2.out&lt;BR /&gt;rm top.out&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;In order to get the % of free memory, i want to get the total memory and the free memory from the command top. And then I would do some aritmethic operation on it. But I get the following error : &lt;BR /&gt;&lt;BR /&gt;sed: command garbled: s/M/p&lt;BR /&gt;&lt;BR /&gt;any idea ?&lt;BR /&gt;&lt;BR /&gt;thank you&lt;BR /&gt;alfredo&lt;BR /&gt;</description>
      <pubDate>Wed, 03 Jul 2002 11:31:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757070#M71654</guid>
      <dc:creator>Alfredo_9</dc:creator>
      <dc:date>2002-07-03T11:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757071#M71655</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Try with :&lt;BR /&gt;sed 's/M/p/' top2.out&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Fr??d??ric &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 03 Jul 2002 11:38:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757071#M71655</guid>
      <dc:creator>Frederic Sevestre</dc:creator>
      <dc:date>2002-07-03T11:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757072#M71656</link>
      <description>Hi Alfredo:&lt;BR /&gt;&lt;BR /&gt;Try these changes:&lt;BR /&gt;&lt;BR /&gt;# top -d 1 -f top.out&lt;BR /&gt;&lt;BR /&gt;...the -f option pushes the output to the file.&lt;BR /&gt;&lt;BR /&gt;# sed -e '/M/'p top2.out&lt;BR /&gt;&lt;BR /&gt;...to print the Memory line...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 03 Jul 2002 11:50:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757072#M71656</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-07-03T11:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757073#M71657</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;  U read that sed line once again carefully. U can see an error. U will have to re write like this&lt;BR /&gt;&lt;BR /&gt;sed 's/M/p/g' file&lt;BR /&gt;&lt;BR /&gt;  Here g is for global substitution. Anyway U should use / after p.&lt;BR /&gt;&lt;BR /&gt;Best of luck&lt;BR /&gt;Shahul</description>
      <pubDate>Wed, 03 Jul 2002 11:52:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757073#M71657</guid>
      <dc:creator>Shahul</dc:creator>
      <dc:date>2002-07-03T11:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757074#M71658</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;use top -f top.out&lt;BR /&gt;&lt;BR /&gt;This gives the top output written clearly&lt;BR /&gt;&lt;BR /&gt;Then work on the file contents.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat top.out | egrep '^Memory' | awk ' {print $2 " " $4 " "$5 " " $7 " " $8 " "$9}'&lt;BR /&gt;&lt;BR /&gt;              steve Steel</description>
      <pubDate>Wed, 03 Jul 2002 11:57:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757074#M71658</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2002-07-03T11:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757075#M71659</link>
      <description>Hi Alfredo,&lt;BR /&gt;&lt;BR /&gt;I just refined your script like this&lt;BR /&gt;&lt;BR /&gt;# cat top_script&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;set -x&lt;BR /&gt;top -d 1 -f top.out&lt;BR /&gt;cat top.out | egrep '^Memory' | awk ' {print $2 " " $4}' &amp;gt; top2.out&lt;BR /&gt;sed 's/M/p/' top2.out&lt;BR /&gt;rm top.out&lt;BR /&gt;exit 0</description>
      <pubDate>Wed, 03 Jul 2002 12:01:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757075#M71659</guid>
      <dc:creator>Sukant Naik</dc:creator>
      <dc:date>2002-07-03T12:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757076#M71660</link>
      <description>Here is a script that eliminates the need for scratch files as well as reducing it down to one awk process.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;set `top -d 1 2&amp;gt;&amp;amp;1 | awk '/^Memory/{sub(/K/,"",$2);sub(/K/,"",$8);print $2 " " $8}'`&lt;BR /&gt;echo `expr 100 \* $2 / $1` %&lt;BR /&gt;&lt;BR /&gt;The first line will extract the total and free memory and set it to $1 and $2 respectivelly (via the "set" command).&lt;BR /&gt;&lt;BR /&gt;The second line will calculate the percentage and display the results.&lt;BR /&gt;example-&lt;BR /&gt;13 %&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;A perl routine would look nicer, but this shell script will get the job done.&lt;BR /&gt;&lt;BR /&gt;Hope this helps...&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;BR /&gt;</description>
      <pubDate>Wed, 03 Jul 2002 13:53:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757076#M71660</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-07-03T13:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757077#M71661</link>
      <description>Alferdo&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have another suggsestion  I got a script form these forums which cgive the o/p like this :&lt;BR /&gt;&lt;BR /&gt;Memory Stat      total   used  avail  %used&lt;BR /&gt;physical        32764.0 24296.4 8467.6    74%&lt;BR /&gt;active virtual  16899.8 10480.4 6419.4    62%&lt;BR /&gt;active real     18039.3 10747.2 7292.1    60%&lt;BR /&gt;memory swap     26522.5 19504.4 7018.1    74%&lt;BR /&gt;device swap     3332.0 3332.0    0.0   100%&lt;BR /&gt;&lt;BR /&gt;So you can just run this and grep on what ever you want to see . I have attached the uncompiled version with the posting</description>
      <pubDate>Wed, 03 Jul 2002 14:01:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problem/m-p/2757077#M71661</guid>
      <dc:creator>MANOJ SRIVASTAVA</dc:creator>
      <dc:date>2002-07-03T14:01:13Z</dc:date>
    </item>
  </channel>
</rss>

