<?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: How to extract char from string in $variable? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780567#M99335</link>
    <description>Thanks Raj!&lt;BR /&gt;I've got it!</description>
    <pubDate>Tue, 02 May 2006 01:58:37 GMT</pubDate>
    <dc:creator>Andrew Yip</dc:creator>
    <dc:date>2006-05-02T01:58:37Z</dc:date>
    <item>
      <title>How to extract char from string in $variable?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780564#M99332</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;How do i extract certain characters from a string stored in a $variable?&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;set text = "01L"&lt;BR /&gt;&lt;BR /&gt;i want to extract and store "01" only into another $variable. Thanks!</description>
      <pubDate>Tue, 02 May 2006 01:34:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780564#M99332</guid>
      <dc:creator>Andrew Yip</dc:creator>
      <dc:date>2006-05-02T01:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract char from string in $variable?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780565#M99333</link>
      <description>try&lt;BR /&gt;echo $text|cut -c 1,2&lt;BR /&gt;or&lt;BR /&gt;echo $text|cut -c 1-2 (to any digits you want to cut)</description>
      <pubDate>Tue, 02 May 2006 01:44:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780565#M99333</guid>
      <dc:creator>Rajeev  Shukla</dc:creator>
      <dc:date>2006-05-02T01:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract char from string in $variable?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780566#M99334</link>
      <description>say your assign the value to $valiable as&lt;BR /&gt;export variable="01L"&lt;BR /&gt;var1=`echo $variable|cut -c 1,2`&lt;BR /&gt;echo $var1</description>
      <pubDate>Tue, 02 May 2006 01:47:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780566#M99334</guid>
      <dc:creator>Rajeev  Shukla</dc:creator>
      <dc:date>2006-05-02T01:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract char from string in $variable?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780567#M99335</link>
      <description>Thanks Raj!&lt;BR /&gt;I've got it!</description>
      <pubDate>Tue, 02 May 2006 01:58:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780567#M99335</guid>
      <dc:creator>Andrew Yip</dc:creator>
      <dc:date>2006-05-02T01:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract char from string in $variable?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780568#M99336</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.google.com/url?sa=t&amp;amp;ct=res&amp;amp;cd=2&amp;amp;url=http%3A%2F%2Fwww.dreamsyssoft.com%2Funix-shell-scripting%2Fadvanced-tutorial.php&amp;amp;ei=ef5WRJHWI7_SwgHy1OT5Bw&amp;amp;sig2=IZ1E-i7ZUt4wAbup0PpOR" target="_blank"&gt;http://www.google.com/url?sa=t&amp;amp;ct=res&amp;amp;cd=2&amp;amp;url=http%3A%2F%2Fwww.dreamsyssoft.com%2Funix-shell-scripting%2Fadvanced-tutorial.php&amp;amp;ei=ef5WRJHWI7_SwgHy1OT5Bw&amp;amp;sig2=IZ1E-i7ZUt4wAbup0PpOR&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.google.com/url?sa=t&amp;amp;ct=res&amp;amp;cd=1&amp;amp;url=http%3A%2F%2Fwww.cactus.org%2F~dak%2Fshellscript.html&amp;amp;ei=ef5WRJHWI7_SwgHy1OT5Bw&amp;amp;sig2=KsUK1AlA6rlf7qHRH5ZgvQ" target="_blank"&gt;http://www.google.com/url?sa=t&amp;amp;ct=res&amp;amp;cd=1&amp;amp;url=http%3A%2F%2Fwww.cactus.org%2F~dak%2Fshellscript.html&amp;amp;ei=ef5WRJHWI7_SwgHy1OT5Bw&amp;amp;sig2=KsUK1AlA6rlf7qHRH5ZgvQ&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Perhaps these links will help.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 02 May 2006 02:14:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780568#M99336</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-05-02T02:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract char from string in $variable?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780569#M99337</link>
      <description>&lt;BR /&gt;Andrew,&lt;BR /&gt;&lt;BR /&gt;I'm glad you found a solution.&lt;BR /&gt;However, it involves a fork of a utility where it seems that a native shell command can do the trick.&lt;BR /&gt;For onesies-twosies it does not matter,  for commands executed in a tight loop it can make a critical difference in execution performance.&lt;BR /&gt;&lt;BR /&gt;The shell has several editing operations.&lt;BR /&gt;In your case i woudl consider 'tail end pattern deletion'&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;# text="01L"&lt;BR /&gt;# other=${text%[A-Z]}&lt;BR /&gt;# echo $other&lt;BR /&gt;01&lt;BR /&gt;&lt;BR /&gt;from "man ksh"&lt;BR /&gt;:&lt;BR /&gt;${parameter%pattern}&lt;BR /&gt;:&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.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Tue, 02 May 2006 06:41:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-extract-char-from-string-in-variable/m-p/3780569#M99337</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-05-02T06:41:55Z</dc:date>
    </item>
  </channel>
</rss>

