<?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: HELP! script to analyze a string in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993343#M124902</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The file 'list' has the following lines&lt;BR /&gt;&lt;BR /&gt;$cat list&lt;BR /&gt;/usr/112/*/conf&lt;BR /&gt;/usr/askdj/eml/*&lt;BR /&gt;/usr/askjk*/ems/&lt;BR /&gt;/usr/askjk/ems/&lt;BR /&gt;*/usr/askjk*/ems/&lt;BR /&gt;&lt;BR /&gt;$awk '/\/\*/ {print}' list&lt;BR /&gt;/usr/112/*/conf&lt;BR /&gt;/usr/askdj/eml/*&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is this what you wanted?.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
    <pubDate>Tue, 10 Jun 2003 12:49:31 GMT</pubDate>
    <dc:creator>Sridhar Bhaskarla</dc:creator>
    <dc:date>2003-06-10T12:49:31Z</dc:date>
    <item>
      <title>HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993342#M124901</link>
      <description>Hello colleagues,&lt;BR /&gt;I need some help...&lt;BR /&gt;I'm writing a script in Korn shell and I should parse a string contained in a file; the string is a file name, it can contain wildcards; I want parse the string to discover if the wildcards are before the last "/" in the name, i.e. if&lt;BR /&gt;/usr/1353sh/*/conf/&lt;BR /&gt;or /usr/1353sh/eml/*&lt;BR /&gt;How can I parse the string? I don't know the awk .........</description>
      <pubDate>Tue, 10 Jun 2003 12:41:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993342#M124901</guid>
      <dc:creator>Enrico Venturi</dc:creator>
      <dc:date>2003-06-10T12:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993343#M124902</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The file 'list' has the following lines&lt;BR /&gt;&lt;BR /&gt;$cat list&lt;BR /&gt;/usr/112/*/conf&lt;BR /&gt;/usr/askdj/eml/*&lt;BR /&gt;/usr/askjk*/ems/&lt;BR /&gt;/usr/askjk/ems/&lt;BR /&gt;*/usr/askjk*/ems/&lt;BR /&gt;&lt;BR /&gt;$awk '/\/\*/ {print}' list&lt;BR /&gt;/usr/112/*/conf&lt;BR /&gt;/usr/askdj/eml/*&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is this what you wanted?.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Tue, 10 Jun 2003 12:49:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993343#M124902</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2003-06-10T12:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993344#M124903</link>
      <description>can use grep,like&lt;BR /&gt;echo "/usr/1353sh/*/conf" | grep "\/\*\/[a-zA-Z]"&lt;BR /&gt;&lt;BR /&gt;Something like that :)&lt;BR /&gt;&lt;BR /&gt;Zeev</description>
      <pubDate>Tue, 10 Jun 2003 12:54:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993344#M124903</guid>
      <dc:creator>Zeev Schultz</dc:creator>
      <dc:date>2003-06-10T12:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993345#M124904</link>
      <description>Not exactly:&lt;BR /&gt;I have a variable (inside my script) which represents a string read from a file; the variable (the string) represents the name of a file, of a directory, of a set of files or directory;&lt;BR /&gt;example:&lt;BR /&gt;$file = /usr/1353sh/AS/conf/*&lt;BR /&gt;or $file = /usr/1353sh/AS/conf/?aram.cfg &lt;BR /&gt;or $file = /usr/1353sh/AS/conf/[a-zA-Z]21.cfg&lt;BR /&gt;i.e. the name can contain wildcards;&lt;BR /&gt;I need to discover if the wildcards are at the end of the file name or are in the middle (i.e. they refer to directories)&lt;BR /&gt;e.g. /usr/1353sh/AS/*/param.cfg&lt;BR /&gt;&lt;BR /&gt;Therefore I have to scan the string and to look for the wildcards, if the wildcards are before the "/" then I suppose that they refer to directory, not to the file name.</description>
      <pubDate>Tue, 10 Jun 2003 13:00:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993345#M124904</guid>
      <dc:creator>Enrico Venturi</dc:creator>
      <dc:date>2003-06-10T13:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993346#M124905</link>
      <description>&lt;BR /&gt;echo $STRING | grep -q '\*$'&lt;BR /&gt;&lt;BR /&gt;if [ $? -eq 0 ]; &lt;BR /&gt;then&lt;BR /&gt;   echo '* is at the end of the string'&lt;BR /&gt;else&lt;BR /&gt;   echo '* is in the middle of the string'&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Hai</description>
      <pubDate>Tue, 10 Jun 2003 13:06:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993346#M124905</guid>
      <dc:creator>Hai Nguyen_1</dc:creator>
      <dc:date>2003-06-10T13:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993347#M124906</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;I'm not sure that knowing if there is a wildcard of any kind somewhere in the string would be easy (or useful ?). There are other wildcards apart of * ...&lt;BR /&gt;&lt;BR /&gt;Perhaps you could rather expand the string and get the real pathes using for example :&lt;BR /&gt;&lt;BR /&gt;set -A LIST $file&lt;BR /&gt;&lt;BR /&gt;then ${#LIST[*]} would give you the number of pathes, each array element being addressed using ${[LIST[x]), ie :&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;A=/usr/bin/li*&lt;BR /&gt;&lt;BR /&gt;set -A LIST $A&lt;BR /&gt;&lt;BR /&gt;i=${#LIST[*]}&lt;BR /&gt;j=0&lt;BR /&gt;while [ $j -lt $i ]&lt;BR /&gt;do&lt;BR /&gt;  echo $j ${LST[j]} # or do anything else ...&lt;BR /&gt;  j=$((j+1))&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Jun 2003 13:18:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993347#M124906</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-06-10T13:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993348#M124907</link>
      <description>echo $filename |&lt;BR /&gt;awk -F"\" '{&lt;BR /&gt;for ( i=1 ; i&lt;NF&gt;&lt;/NF&gt;if ( ( $i ~ "[\*\?\.\[]" ) {&lt;BR /&gt;if ( i == NF ){&lt;BR /&gt;print "wildcard is last field";exit;}&lt;BR /&gt;else {&lt;BR /&gt;print "wildcard is not the last field";exit;}&lt;BR /&gt;}}&lt;BR /&gt;print "no wildcard";&lt;BR /&gt;}'&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Jun 2003 13:31:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993348#M124907</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-06-10T13:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993349#M124908</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The trick is in declaring the variable.&lt;BR /&gt;&lt;BR /&gt;set -f ARG&lt;BR /&gt;ARG='/usr/bin/*'&lt;BR /&gt;echo $ARG |grep "\/\*$" &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo $ARG is a directory&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Tue, 10 Jun 2003 13:32:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993349#M124908</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2003-06-10T13:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993350#M124909</link>
      <description>oops&lt;BR /&gt;&lt;BR /&gt;that awk -F"\" should be&lt;BR /&gt;awk -F"/"</description>
      <pubDate>Tue, 10 Jun 2003 13:33:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993350#M124909</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-06-10T13:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993351#M124910</link>
      <description>another typo&lt;BR /&gt;&lt;BR /&gt;for ( i=1 ; i&lt;NF&gt;&lt;/NF&gt;&lt;BR /&gt;should be&lt;BR /&gt;&lt;BR /&gt;for ( i=1 ; i&amp;lt;=NF; i++ ) { &lt;BR /&gt;&lt;BR /&gt;less then or equal</description>
      <pubDate>Tue, 10 Jun 2003 13:35:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993351#M124910</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-06-10T13:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993352#M124911</link>
      <description>i noticed another typo&lt;BR /&gt;&lt;BR /&gt;so i'm going to do it again, without the typos&lt;BR /&gt;&lt;BR /&gt;echo $filename | &lt;BR /&gt;awk -F"/" '{ &lt;BR /&gt;for ( i=1 ; i&amp;lt;=NF; i++ ) { &lt;BR /&gt;if ( $i ~ "[\*\?\.\[]" ) { &lt;BR /&gt;if ( i == NF ){ &lt;BR /&gt;print "wildcard is last field";exit;} &lt;BR /&gt;else { &lt;BR /&gt;print "wildcard is not the last field";exit;} &lt;BR /&gt;}} &lt;BR /&gt;print "no wildcard"; &lt;BR /&gt;}' &lt;BR /&gt;</description>
      <pubDate>Tue, 10 Jun 2003 13:40:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993352#M124911</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-06-10T13:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993353#M124912</link>
      <description>Here is something that should work. It use a shell capability of pattern matching using ${var%%pattn}.&lt;BR /&gt;&lt;BR /&gt;file1="/usr/1353sh/*/conf"&lt;BR /&gt;x=${file1#*[\[?*]}&lt;BR /&gt;if [ "$x" = "$file1" ] ; then&lt;BR /&gt;  echo "No wildcards in $file1"&lt;BR /&gt;  exit&lt;BR /&gt;fi&lt;BR /&gt;y=${x%/*}&lt;BR /&gt;if [ "$x" = "$y" ] ; then&lt;BR /&gt;  echo "wildcard in filename"&lt;BR /&gt;else&lt;BR /&gt;  echo "wildcard in directory"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;x will be set to the text after the first wildcard character. In this case "*", so x will be "/conf".&lt;BR /&gt;&lt;BR /&gt;If variable x contains a slash then the text string has a wildcard before a directory.&lt;BR /&gt;&lt;BR /&gt;Set y to any text within x that has a slash followed by any characters. If x and y match, then no slash and therefore wildcard is in filename.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Tue, 10 Jun 2003 13:40:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993353#M124912</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-06-10T13:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993354#M124913</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;If ksh is not mandatory, you can do it with perl so easily I think...&lt;BR /&gt;&lt;BR /&gt;pattern = [list of wild characters...]i.e.&lt;BR /&gt;&lt;BR /&gt;pattern = [\*\.-]&lt;BR /&gt;if ($file !~ /pattern/)&lt;BR /&gt;{&lt;BR /&gt;print "No wild Characters\n";&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;print "Wild Characters are present\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;VJ.</description>
      <pubDate>Wed, 11 Jun 2003 10:20:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993354#M124913</guid>
      <dc:creator>vasundhara</dc:creator>
      <dc:date>2003-06-11T10:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! script to analyze a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993355#M124914</link>
      <description>Hey, what perl are you using? I don't know what version supports that syntax:&lt;BR /&gt;&lt;BR /&gt;a5 108 &amp;gt; cat xx.pl&lt;BR /&gt;pattern = [\*\.-]&lt;BR /&gt;if ($file !~ /pattern/)&lt;BR /&gt;{&lt;BR /&gt;print "No wild Characters\n";&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;print "Wild Characters are present\n";&lt;BR /&gt;}&lt;BR /&gt;a5 109 &amp;gt; perl -Mstrict -w xx.pl&lt;BR /&gt;syntax error at xx.pl line 1, near "-]"&lt;BR /&gt;Global symbol "$file" requires explicit package name at xx.pl line 2.&lt;BR /&gt;Execution of xx.pl aborted due to compilation errors.&lt;BR /&gt;Exit 255&lt;BR /&gt;a5 110 &amp;gt;&lt;BR /&gt;&lt;BR /&gt;a5 115 &amp;gt; perl -le'print$ARGV[0]=~/[[*?]/?"has wild":"safe"' '/usr/1353sh/*/conf/'&lt;BR /&gt;has wild&lt;BR /&gt;a5 116 &amp;gt;&lt;BR /&gt;&lt;BR /&gt;But be aware that passing arguments to whatever proces is likely to *NOT* contain wildcards, since shells expand arguments *before* passing them to subprocesses. So either quote them (as in above example) or write the complete script in one language (perl). Then still, you are never sure that passed arguments are not expanded by the shell before you are able to deal with them.&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
      <pubDate>Wed, 11 Jun 2003 10:48:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-script-to-analyze-a-string/m-p/2993355#M124914</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-06-11T10:48:48Z</dc:date>
    </item>
  </channel>
</rss>

