<?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: substring builtin in ksh in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798506#M928692</link>
    <description>Hi Javier,&lt;BR /&gt;&lt;BR /&gt;This functionality appears in ksh version newer than 11/16/88.&lt;BR /&gt;&lt;BR /&gt;Unfortunately, the standard ksh version in HP-UX is 11/16/88 and so does include the latest ksh enhancement.&lt;BR /&gt;&lt;BR /&gt;However sh-posix include a few , but not all of these.</description>
    <pubDate>Wed, 04 Sep 2002 09:09:31 GMT</pubDate>
    <dc:creator>Christophe MAILHE</dc:creator>
    <dc:date>2002-09-04T09:09:31Z</dc:date>
    <item>
      <title>substring builtin in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798501#M928687</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Do you know if there is builtin substring funtion under ksh (Solaris version this time)?</description>
      <pubDate>Tue, 03 Sep 2002 07:21:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798501#M928687</guid>
      <dc:creator>Javier Gutierrez</dc:creator>
      <dc:date>2002-09-03T07:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: substring builtin in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798502#M928688</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;i know no substring function in ksh but you can use awk for this ie:&lt;BR /&gt;&lt;BR /&gt;var="fullstring"&lt;BR /&gt;sub=$(echo $var|awk '{print substr($0,5,3)}')&lt;BR /&gt;&lt;BR /&gt;will set sub to "str"&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Tue, 03 Sep 2002 07:50:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798502#M928688</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2002-09-03T07:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: substring builtin in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798503#M928689</link>
      <description>Standard ksh doesn't have a substring feature but you can use the following construct to manipulate strings... &lt;BR /&gt;&lt;BR /&gt;(From man sh-posix)&lt;BR /&gt;&lt;BR /&gt;${parameter#pattern}&lt;BR /&gt;${parameter##pattern}&lt;BR /&gt;If the shell pattern matches the beginning of the value  of parameter, the value of this substitution is the value of the parameter with the matched portion deleted; otherwise, the value of this parameter is substituted.  In the former case, the smallest matching pattern is deleted; in the latter case, the largest matching pattern is deleted. These characters # or % should be escaped by a backslash (\) or quotes ('').&lt;BR /&gt;&lt;BR /&gt;${parameter%pattern}&lt;BR /&gt;${parameter%%pattern}&lt;BR /&gt;If the shell pattern matches the end of the value of parameter, the value of parameter with the matched part is deleted; otherwise, substitute the value of    parameter.  In the former, the smallest matching pattern is deleted; in the latter, the largest matching pattern is deleted. These characters # or % should be escaped by a backslash (\) or quotes ('').&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John</description>
      <pubDate>Tue, 03 Sep 2002 08:20:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798503#M928689</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2002-09-03T08:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: substring builtin in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798504#M928690</link>
      <description>I don't know sucha function but you may build your own, such as  :&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;# substr &lt;VAR&gt; &lt;START&gt; &lt;LENGTH&gt;&lt;BR /&gt;&lt;BR /&gt;if [ $# -ne 3 ]; then&lt;BR /&gt;  exit 2&lt;BR /&gt;fi&lt;BR /&gt;lg=$(( $2 + $3 - 1 ))&lt;BR /&gt;echo $1 | cut -c$2-$lg&lt;BR /&gt;&lt;BR /&gt;~~~~~~~~~~~~~~~~~~&lt;BR /&gt;oudartj:/home/oudartj/k1 $ substr abcdef 3 2&lt;BR /&gt;cd&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Jean-Luc&lt;/LENGTH&gt;&lt;/START&gt;&lt;/VAR&gt;</description>
      <pubDate>Tue, 03 Sep 2002 08:23:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798504#M928690</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2002-09-03T08:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: substring builtin in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798505#M928691</link>
      <description>Guys thank you very much.&lt;BR /&gt;&lt;BR /&gt;I know that in linux you can do with variables just:&lt;BR /&gt;&amp;gt; a=example&lt;BR /&gt;&amp;gt; echo ${a:0:2}&lt;BR /&gt;exa&lt;BR /&gt;&lt;BR /&gt;I didn't want to use awk and cut, just to optimize and do it faster, but I can see there is no other way.&lt;BR /&gt;&lt;BR /&gt;Thank you so much.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Sep 2002 08:36:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798505#M928691</guid>
      <dc:creator>Javier Gutierrez</dc:creator>
      <dc:date>2002-09-03T08:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: substring builtin in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798506#M928692</link>
      <description>Hi Javier,&lt;BR /&gt;&lt;BR /&gt;This functionality appears in ksh version newer than 11/16/88.&lt;BR /&gt;&lt;BR /&gt;Unfortunately, the standard ksh version in HP-UX is 11/16/88 and so does include the latest ksh enhancement.&lt;BR /&gt;&lt;BR /&gt;However sh-posix include a few , but not all of these.</description>
      <pubDate>Wed, 04 Sep 2002 09:09:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798506#M928692</guid>
      <dc:creator>Christophe MAILHE</dc:creator>
      <dc:date>2002-09-04T09:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: substring builtin in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798507#M928693</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;While certainly not as conservative as a shell built-in you could use:&lt;BR /&gt;&lt;BR /&gt;# expr substr expr1 expr2 expr3&lt;BR /&gt;&lt;BR /&gt;This takes the substring expr1, starting at expr2 for the length given by expr3.&lt;BR /&gt;&lt;BR /&gt;See the man pages for 'expr'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 04 Sep 2002 09:41:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798507#M928693</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-04T09:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: substring builtin in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798508#M928694</link>
      <description>Javier,&lt;BR /&gt;&lt;BR /&gt;You said:&lt;BR /&gt;&lt;BR /&gt;**********************************&lt;BR /&gt;I didn't want to use awk and cut, just to optimize and do it faster, but I can see there is no other way. &lt;BR /&gt;**********************************&lt;BR /&gt;&lt;BR /&gt;Are you kidding me??&lt;BR /&gt;&lt;BR /&gt;awk is a thousand (maybe a little exaggeration) times faster than ksh could ever imagine being.&lt;BR /&gt;&lt;BR /&gt;And if you are serious about doing any kind of string parsing you should use either awk or better yet: perl!!!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Wed, 04 Sep 2002 10:44:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798508#M928694</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-09-04T10:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: substring builtin in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798509#M928695</link>
      <description>Hi, &lt;BR /&gt;I'm trying to do a similar thing.  I have the string:&lt;BR /&gt;"              N           SAS Shared Components" Notice the spaces. I need to substring from 0-14 15-26 27-48.  I tried the command above, but it starts with the first non-blank character (N).  Any suggestions?&lt;BR /&gt;Thanks,&lt;BR /&gt;MOnica</description>
      <pubDate>Tue, 25 Mar 2003 22:53:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798509#M928695</guid>
      <dc:creator>monica dastous</dc:creator>
      <dc:date>2003-03-25T22:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: substring builtin in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798510#M928696</link>
      <description>as mr mailhe points out /usr/bin/ksh in hp-ux is the 88 version, which doesn't include the majority of enhancements that are in the 93 version.  &lt;BR /&gt;&lt;BR /&gt;but, quite a few of the 93 enhancements are included in /usr/dt/bin/dtksh. using this shell you will be able to do a substring using an offset and length.&lt;BR /&gt;&lt;BR /&gt;monica, your probably better off using the cut command.</description>
      <pubDate>Wed, 26 Mar 2003 00:03:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substring-builtin-in-ksh/m-p/2798510#M928696</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-03-26T00:03:11Z</dc:date>
    </item>
  </channel>
</rss>

