<?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: PERL pattern matching in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/perl-pattern-matching/m-p/4045534#M94131</link>
    <description>What do you mean by patterns?  A file can have tokens or words but RE patterns is something only a human can find.  After all, one pattern can be made for all English words.&lt;BR /&gt;&lt;BR /&gt;If you want to search for space delimited alphabetic tokens you can use:&lt;BR /&gt;$ tr -cs "[A-Z][a-z]" "[\012*]" &amp;lt; file | sort | uniq -c</description>
    <pubDate>Sat, 28 Jul 2007 21:01:57 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2007-07-28T21:01:57Z</dc:date>
    <item>
      <title>PERL pattern matching</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-pattern-matching/m-p/4045532#M94129</link>
      <description>I have a flat file which contains hundreds of patterns. I need to write a PERL script that parses this file and returns each unique pattern and the count of its occurance. &lt;BR /&gt;&lt;BR /&gt;I am trying it for quite sometime but not able to code it.&lt;BR /&gt;&lt;BR /&gt;Can anyone please help.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Pat</description>
      <pubDate>Sat, 28 Jul 2007 13:42:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-pattern-matching/m-p/4045532#M94129</guid>
      <dc:creator>Pat Tom</dc:creator>
      <dc:date>2007-07-28T13:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: PERL pattern matching</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-pattern-matching/m-p/4045533#M94130</link>
      <description>&lt;!--!*#--&gt;#!/opt/perl/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;my %pat;&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;    $pat{$_}++;&lt;BR /&gt;    }&lt;BR /&gt;foreach my $pat (sort keys %pat) {&lt;BR /&gt;    printf "%6d %s", $pat{$pat}, $pat;&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Sat, 28 Jul 2007 14:48:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-pattern-matching/m-p/4045533#M94130</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2007-07-28T14:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: PERL pattern matching</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-pattern-matching/m-p/4045534#M94131</link>
      <description>What do you mean by patterns?  A file can have tokens or words but RE patterns is something only a human can find.  After all, one pattern can be made for all English words.&lt;BR /&gt;&lt;BR /&gt;If you want to search for space delimited alphabetic tokens you can use:&lt;BR /&gt;$ tr -cs "[A-Z][a-z]" "[\012*]" &amp;lt; file | sort | uniq -c</description>
      <pubDate>Sat, 28 Jul 2007 21:01:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-pattern-matching/m-p/4045534#M94131</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-07-28T21:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: PERL pattern matching</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-pattern-matching/m-p/4045535#M94132</link>
      <description>&lt;!--!*#--&gt;Hi Pat:&lt;BR /&gt;&lt;BR /&gt;Merijn's script gives you the solution based on the contents of a *line*.  If your lines contain multiple "words" this variation gives you their unique counts.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;my %pat;&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;    my @a=m{\w+}g;&lt;BR /&gt;    $pat{$_}++ for (@a);&lt;BR /&gt;}&lt;BR /&gt;foreach my $pat (sort keys %pat) {&lt;BR /&gt;    printf "%6d %s\n", $pat{$pat}, $pat;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;The \w regular expression matches an alphanumeric character or underscore but not a hyphen, quote, comma, semicolon, colons, etc.&lt;BR /&gt;&lt;BR /&gt;As for writing the word "PERL" -- don't -- we are speaking of the "Perl" language:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.perl.org/about/style-guide.html" target="_blank"&gt;http://www.perl.org/about/style-guide.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You have previously posted another question about pattern matching for which solutions were provided.   You forgot to score those solutions.  It would be appreciated:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1100015" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1100015&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 29 Jul 2007 15:30:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-pattern-matching/m-p/4045535#M94132</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-07-29T15:30:31Z</dc:date>
    </item>
  </channel>
</rss>

