<?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: filename pattern matching in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039826#M134178</link>
    <description>ls -l [a-z] [0-9] [0-9] *| [a-z] [a-z] [0-9]*| [a-z] [0-9] [a-z] *&lt;BR /&gt;&lt;BR /&gt;I haven't tested it, but this should work.</description>
    <pubDate>Mon, 04 Aug 2003 18:07:25 GMT</pubDate>
    <dc:creator>Chris Vail</dc:creator>
    <dc:date>2003-08-04T18:07:25Z</dc:date>
    <item>
      <title>filename pattern matching</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039822#M134174</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I need to write a script that will do pattern matching of filenames.  The pattern to be matched is the first 3 characters  of the file and they must have this pattern:&lt;BR /&gt;&lt;BR /&gt;A=alpha N=numeric&lt;BR /&gt;ANN AAN ANA&lt;BR /&gt;&lt;BR /&gt;Any help appreciated!&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Sat, 02 Aug 2003 09:55:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039822#M134174</guid>
      <dc:creator>Mike Blansfield_1</dc:creator>
      <dc:date>2003-08-02T09:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: filename pattern matching</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039823#M134175</link>
      <description>using dtksh you can do something like this&lt;BR /&gt;&lt;BR /&gt;#!/usr/dt/bin/dtksh&lt;BR /&gt;&lt;BR /&gt;while read filename&lt;BR /&gt;do&lt;BR /&gt;case $filename in&lt;BR /&gt;[:alpha:][:alnum:][:alnum:]*) print $filename;;&lt;BR /&gt;esac&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;of&lt;BR /&gt;&lt;BR /&gt;if [[ "$filename" = [[:alpha:][:alnum:][:alnum:]]* ]] ;then&lt;BR /&gt;print $filename&lt;BR /&gt;fi</description>
      <pubDate>Sat, 02 Aug 2003 13:52:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039823#M134175</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-08-02T13:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: filename pattern matching</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039824#M134176</link>
      <description>Hi Mike:&lt;BR /&gt;&lt;BR /&gt;I'll use regular expressions with 'awk' and 'ls' to generate the input:&lt;BR /&gt;&lt;BR /&gt;# ls -l|awk '$NF~/^[[:alpha:]][0-9]][0-9]/ || $NF~/^[[:alpha:]][[:alpha:]][0-9]/ || $NF~/^[[:alpha:]][0-9]][[:alpha:]]/ {print $NF}' &lt;BR /&gt;&lt;BR /&gt;This takes the output from 'ls' and examines the filename (the last field of each line) and prints it if it meets the criteria you specified for the first three characters.  The '||' is an 'or' operator.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 02 Aug 2003 13:52:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039824#M134176</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-08-02T13:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: filename pattern matching</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039825#M134177</link>
      <description>or using sed&lt;BR /&gt;&lt;BR /&gt;ls |&lt;BR /&gt;sed -n '/^[:alpha:][:alpha:,0-9]\{2\}/p'</description>
      <pubDate>Sat, 02 Aug 2003 13:56:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039825#M134177</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-08-02T13:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: filename pattern matching</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039826#M134178</link>
      <description>ls -l [a-z] [0-9] [0-9] *| [a-z] [a-z] [0-9]*| [a-z] [0-9] [a-z] *&lt;BR /&gt;&lt;BR /&gt;I haven't tested it, but this should work.</description>
      <pubDate>Mon, 04 Aug 2003 18:07:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039826#M134178</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2003-08-04T18:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: filename pattern matching</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039827#M134179</link>
      <description>Hi,&lt;BR /&gt;I have tested this and it seems to work:&lt;BR /&gt; (should be on a single line with no spaces between ??? and ???):&lt;BR /&gt;&lt;BR /&gt;# ls &lt;YOUR_DIR&gt; | egrep "^[[:alpha:]][[:digit:]][[:digit:]]|^[[:alpha:]][[:alpha:]][[:digit:]]|^[[:alpha:]][[:digit:]][[:alpha:]]"&lt;BR /&gt;&lt;BR /&gt;It has the obvious advantage of being easy to read!&lt;BR /&gt;The output from ls is redirected to egrep, which tries to match the extended reg. expression described between ??? and ???&lt;BR /&gt;The expression itself holds three alternatives, separated from one another by a pipe character.&lt;BR /&gt;Each alternative starts with the hat/caret character, which means ???must start with this???.&lt;BR /&gt;The allowed character combination for each alternative is described by so-called character-classes, e.g. [:alpha:] meaning any alphabetical character. A class is always surrounded by colons and a set of square brackets.&lt;BR /&gt;What you put in between square brackets, in this case the ???outer??? square brackets, means ???match any single one of  the character(s) mentioned.&lt;BR /&gt;Hence, match any one alphabethical character appearing at the beginning looks like this: ^[[:alpha:]]&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K&lt;BR /&gt;&lt;/YOUR_DIR&gt;</description>
      <pubDate>Tue, 05 Aug 2003 10:35:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/filename-pattern-matching/m-p/3039827#M134179</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-08-05T10:35:48Z</dc:date>
    </item>
  </channel>
</rss>

