<?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 match pattern used in grep command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124584#M802783</link>
    <description>Hi.&lt;BR /&gt;&lt;BR /&gt;A script provided by my HP Account engineer requested me the system handle of my box. But the following error messages was repoted:&lt;BR /&gt;&lt;BR /&gt;Unprintable character in 'MYSYSTEM-9000'.&lt;BR /&gt;&lt;BR /&gt;I debbuged that script and found the lines that check my input:&lt;BR /&gt;&lt;BR /&gt;        if [ "`echo $user_info | grep '^[ !-~]*$'`" = "" ]&lt;BR /&gt;        then&lt;BR /&gt;            echo ""&lt;BR /&gt;            echo "Unprintable character in '$user_info'."&lt;BR /&gt;            continue&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;The problem was the grep command. The following  command line prints nothing:&lt;BR /&gt;&lt;BR /&gt;echo hello | grep '^[ !-~]*$'&lt;BR /&gt;&lt;BR /&gt;but the following alternate command line works fine:&lt;BR /&gt;&lt;BR /&gt;echo hello | LANG= grep '^[ !-~]*$'&lt;BR /&gt;hello&lt;BR /&gt;&lt;BR /&gt;I notice that grep command runs fine or not according to NLS environment (my usual LANG value is es_ES.iso88591) but what is NLS-dependant on that match pattern [ !-~] ?&lt;BR /&gt;&lt;BR /&gt;According to ASCII table [ !-~] should be equivalent to [ -~] because "space" char and "!" are consecutive. This range includes all printable 7-bit ASCII characters. Therefore no problems related to NLS should be appear, shouldn't it ?&lt;BR /&gt;</description>
    <pubDate>Thu, 20 Nov 2003 05:52:57 GMT</pubDate>
    <dc:creator>Jdamian</dc:creator>
    <dc:date>2003-11-20T05:52:57Z</dc:date>
    <item>
      <title>RE match pattern used in grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124584#M802783</link>
      <description>Hi.&lt;BR /&gt;&lt;BR /&gt;A script provided by my HP Account engineer requested me the system handle of my box. But the following error messages was repoted:&lt;BR /&gt;&lt;BR /&gt;Unprintable character in 'MYSYSTEM-9000'.&lt;BR /&gt;&lt;BR /&gt;I debbuged that script and found the lines that check my input:&lt;BR /&gt;&lt;BR /&gt;        if [ "`echo $user_info | grep '^[ !-~]*$'`" = "" ]&lt;BR /&gt;        then&lt;BR /&gt;            echo ""&lt;BR /&gt;            echo "Unprintable character in '$user_info'."&lt;BR /&gt;            continue&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;The problem was the grep command. The following  command line prints nothing:&lt;BR /&gt;&lt;BR /&gt;echo hello | grep '^[ !-~]*$'&lt;BR /&gt;&lt;BR /&gt;but the following alternate command line works fine:&lt;BR /&gt;&lt;BR /&gt;echo hello | LANG= grep '^[ !-~]*$'&lt;BR /&gt;hello&lt;BR /&gt;&lt;BR /&gt;I notice that grep command runs fine or not according to NLS environment (my usual LANG value is es_ES.iso88591) but what is NLS-dependant on that match pattern [ !-~] ?&lt;BR /&gt;&lt;BR /&gt;According to ASCII table [ !-~] should be equivalent to [ -~] because "space" char and "!" are consecutive. This range includes all printable 7-bit ASCII characters. Therefore no problems related to NLS should be appear, shouldn't it ?&lt;BR /&gt;</description>
      <pubDate>Thu, 20 Nov 2003 05:52:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124584#M802783</guid>
      <dc:creator>Jdamian</dc:creator>
      <dc:date>2003-11-20T05:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: RE match pattern used in grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124585#M802784</link>
      <description>I am not that experienced with the NLS settings, but I think you also need to check if it is related to the tilde ('~') character...&lt;BR /&gt;Just try different patterns for your grep RE to see if it is indeed the ' !' that is causing the problem or the '~' character...</description>
      <pubDate>Thu, 20 Nov 2003 06:01:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124585#M802784</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2003-11-20T06:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: RE match pattern used in grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124586#M802785</link>
      <description>Hello !&lt;BR /&gt;Not clear understand what are you trying to do. The first of your command (echo hello | grep '^[ !-~]*$') output nothing because where are no any of ^[ !-~]*$ characters in the world "hello". So no matches. The second command you printed assigns string value &lt;GREP&gt; to $LANG variable. I.e.&lt;BR /&gt;# echo hello | LANG=grep'^[ !-~]*$'&lt;BR /&gt;output nothing&lt;BR /&gt;# echo $LANG&lt;BR /&gt;grep^[ !-~]*$&lt;/GREP&gt;</description>
      <pubDate>Thu, 20 Nov 2003 07:09:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124586#M802785</guid>
      <dc:creator>Artyom Voronchihin</dc:creator>
      <dc:date>2003-11-20T07:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: RE match pattern used in grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124587#M802786</link>
      <description>Hi,&lt;BR /&gt;if grep does not find any of the strange characters it looks for, the if sentence will be true:&lt;BR /&gt;if [ "" = "" ]&lt;BR /&gt;under which circumstances it says that there is an unprintable character. &lt;BR /&gt;Is there not the slightest possibility that a not operator is missing, e.g.:&lt;BR /&gt;if [ "`echo $user_info | grep '^[ !-~]*$'`" != "" ]&lt;BR /&gt;&lt;BR /&gt;Just wondering...&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Thu, 20 Nov 2003 07:17:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124587#M802786</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-11-20T07:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: RE match pattern used in grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124588#M802787</link>
      <description>Hi Artyom. I see you don't understand my question.&lt;BR /&gt;&lt;BR /&gt;1) the match pattern [ !-~ ] means to match any character that is:&lt;BR /&gt;a space (ASCII code 32)&lt;BR /&gt;or&lt;BR /&gt;any char between ! (ASCII code 31) and ~ (ASCII code 126)... this means any ASCII char.&lt;BR /&gt;&lt;BR /&gt;2) There is a space char between the sign = and 'grep' word, then I'm assigning nothing to LANG variable.&lt;BR /&gt;&lt;BR /&gt;I checked LC_COLLATE section in file /usr/lib/nls/loc/src/es_ES.iso885915.src&lt;BR /&gt;and found a strange order. Meanwhile order found in C.src is identical to ASCII char, order set in es_ES.iso88591.src doesn't look to be right (perhaps).&lt;BR /&gt;&lt;BR /&gt;I tried another tests:&lt;BR /&gt;&lt;BR /&gt;$ echo hello | LANG= grep '^["-z]*$'&lt;BR /&gt;hello&lt;BR /&gt;$ echo hello | LANG=es_ES.iso88591 grep '^["-z]*$'&lt;BR /&gt;grep: Rango no vÃ¡lido en expresiÃ³n [].&lt;BR /&gt;&lt;BR /&gt;The error messages appears in Spanish.&lt;BR /&gt;The translation is:&lt;BR /&gt;grep: Invalid range within [] expression.&lt;BR /&gt;&lt;BR /&gt;The same behaviour is found when other values (as it_IT.roman8) for LANG are us</description>
      <pubDate>Thu, 20 Nov 2003 07:47:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124588#M802787</guid>
      <dc:creator>Jdamian</dc:creator>
      <dc:date>2003-11-20T07:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: RE match pattern used in grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124589#M802788</link>
      <description>It is solvable by using this pattern:&lt;BR /&gt;grep '^[\037-\0176]*$'&lt;BR /&gt;</description>
      <pubDate>Thu, 20 Nov 2003 08:36:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/re-match-pattern-used-in-grep-command/m-p/3124589#M802788</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2003-11-20T08:36:53Z</dc:date>
    </item>
  </channel>
</rss>

