<?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 command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479860#M776688</link>
    <description>First, your commands do not work Curtis.  Even with your correction $value is still 5%).&lt;BR /&gt;&lt;BR /&gt;Best bet is to use sed to strip the unwanted characters.  Inside your script you can use 3 lines of sed to get rid of the known characters you do not want.&lt;BR /&gt;input="(5%)"&lt;BR /&gt;step1=`echo ${input} | sed -e '1,$s/(//g'` &lt;BR /&gt;step2=`echo ${step1} | sed -e '1,$s/)//g'`&lt;BR /&gt;output=`echo ${step2} | sed -e '1,$s/%//g'`&lt;BR /&gt;echo $output &lt;BR /&gt;5&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shannon</description>
    <pubDate>Fri, 05 Jan 2001 17:42:14 GMT</pubDate>
    <dc:creator>Shannon Petry</dc:creator>
    <dc:date>2001-01-05T17:42:14Z</dc:date>
    <item>
      <title>Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479853#M776681</link>
      <description>I have a script command that isues the follwing output. &lt;BR /&gt;(5%).&lt;BR /&gt;&lt;BR /&gt;I need to strip the parens, the percent and the period from the output. The number may be a one, two or three digit number. Does anyone know how to remove the other characters? Thanks.</description>
      <pubDate>Fri, 05 Jan 2001 15:52:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479853#M776681</guid>
      <dc:creator>Scott E Smith</dc:creator>
      <dc:date>2001-01-05T15:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479854#M776682</link>
      <description>you can use sed in your script.&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;number=`echo $number | sed -e '1,$s/(//g'`&lt;BR /&gt;number=`echo $number | sed -e '1,$s/).//g'`&lt;BR /&gt;&lt;BR /&gt;You would need both lines to get rid of the stuff on both sides of the number.</description>
      <pubDate>Fri, 05 Jan 2001 15:58:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479854#M776682</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-01-05T15:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479855#M776683</link>
      <description>| tr -d "[(,),%,.]"</description>
      <pubDate>Fri, 05 Jan 2001 15:59:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479855#M776683</guid>
      <dc:creator>Curtis Larson</dc:creator>
      <dc:date>2001-01-05T15:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479856#M776684</link>
      <description>value="(5%)."&lt;BR /&gt;value=${value%%%*}&lt;BR /&gt;value=${value##\(*}&lt;BR /&gt;print $value</description>
      <pubDate>Fri, 05 Jan 2001 16:04:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479856#M776684</guid>
      <dc:creator>Curtis Larson</dc:creator>
      <dc:date>2001-01-05T16:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479857#M776685</link>
      <description>Hi Scott,&lt;BR /&gt;&lt;BR /&gt;Here is a sed construct using regular expressions. It's a bit more general as it suppresses all non-digit characters:&lt;BR /&gt;&lt;BR /&gt;echo $number | sed 's/[^[:digit:]]//g'&lt;BR /&gt;&lt;BR /&gt;see man 5 regexp for details&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;</description>
      <pubDate>Fri, 05 Jan 2001 16:12:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479857#M776685</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-01-05T16:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479858#M776686</link>
      <description>oops,&lt;BR /&gt;&lt;BR /&gt;value=${value##\(*} &lt;BR /&gt;&lt;BR /&gt;should have been:&lt;BR /&gt; &lt;BR /&gt;value=${value##*\(} &lt;BR /&gt;</description>
      <pubDate>Fri, 05 Jan 2001 16:13:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479858#M776686</guid>
      <dc:creator>Curtis Larson</dc:creator>
      <dc:date>2001-01-05T16:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479859#M776687</link>
      <description>Thnak you all very much. The response is great.....</description>
      <pubDate>Fri, 05 Jan 2001 17:41:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479859#M776687</guid>
      <dc:creator>Scott E Smith</dc:creator>
      <dc:date>2001-01-05T17:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479860#M776688</link>
      <description>First, your commands do not work Curtis.  Even with your correction $value is still 5%).&lt;BR /&gt;&lt;BR /&gt;Best bet is to use sed to strip the unwanted characters.  Inside your script you can use 3 lines of sed to get rid of the known characters you do not want.&lt;BR /&gt;input="(5%)"&lt;BR /&gt;step1=`echo ${input} | sed -e '1,$s/(//g'` &lt;BR /&gt;step2=`echo ${step1} | sed -e '1,$s/)//g'`&lt;BR /&gt;output=`echo ${step2} | sed -e '1,$s/%//g'`&lt;BR /&gt;echo $output &lt;BR /&gt;5&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shannon</description>
      <pubDate>Fri, 05 Jan 2001 17:42:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479860#M776688</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2001-01-05T17:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479861#M776689</link>
      <description>Shannon,&lt;BR /&gt;&lt;BR /&gt;sorry, the above didn't work for you. I guess I should have specified the shell.&lt;BR /&gt;&lt;BR /&gt;it does work for ksh, for the posix shell you'll have to backslash the 3rd % character and if ksh was newer the 88 version you'd could have just done:&lt;BR /&gt;&lt;BR /&gt;value=${value//[![:digit:]]/}&lt;BR /&gt;print $value&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 05 Jan 2001 18:24:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479861#M776689</guid>
      <dc:creator>Curtis Larson</dc:creator>
      <dc:date>2001-01-05T18:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479862#M776690</link>
      <description>Curtis,&lt;BR /&gt;thanks for clarifying.  It does work in Korn Shell.  I'll have to do more with korn one day......POSIX is global, so I use it all the time.  Scripts in SCO, Linux, SunOS, HP-UX, AIX, and IRIX all work using the posix standard shell commands.........&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shannon</description>
      <pubDate>Fri, 05 Jan 2001 19:15:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479862#M776690</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2001-01-05T19:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Script command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479863#M776691</link>
      <description>Just some more variants:&lt;BR /&gt;| awk -F\( '{print $2}' | awk -F% '{print $1}'&lt;BR /&gt;or with sed (which BTW can take several "edits" as arguments, so no need to divide):&lt;BR /&gt;| sed -e 's:(::' -e 's:%.$::'&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jan 2001 07:24:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-command/m-p/2479863#M776691</guid>
      <dc:creator>Tommy Palo</dc:creator>
      <dc:date>2001-01-08T07:24:17Z</dc:date>
    </item>
  </channel>
</rss>

