<?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: ShellScript help pl in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406773#M201828</link>
    <description>and finally, in case you need some further data massaging along the lines (sic), here is an awk solution for a sorted file:&lt;BR /&gt;&lt;BR /&gt;awk 'BEGIN {getline x}{i++;if (x!=$0) {print x,i;i=0;x=$0}} END {print x, ++i}' sorted_input&lt;BR /&gt;&lt;BR /&gt;BEGIN - preset last seen record value&lt;BR /&gt;loop  - always count. if new value not equal to old then: print value &amp;amp;count and reset value &amp;amp; count&lt;BR /&gt;END - print final value &amp;amp; count&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
    <pubDate>Mon, 25 Oct 2004 06:44:16 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2004-10-25T06:44:16Z</dc:date>
    <item>
      <title>ShellScript help pl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406769#M201824</link>
      <description>Hi Masters,&lt;BR /&gt;  I've the following file,&lt;BR /&gt;1  a&lt;BR /&gt;1  a&lt;BR /&gt;1  a&lt;BR /&gt;1  b&lt;BR /&gt;1  b&lt;BR /&gt;&lt;BR /&gt;I want the following output:&lt;BR /&gt;1   a   3&lt;BR /&gt;1   b   2&lt;BR /&gt;&lt;BR /&gt;Pl help&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Oct 2004 02:56:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406769#M201824</guid>
      <dc:creator>Ashwin_4</dc:creator>
      <dc:date>2004-10-25T02:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: ShellScript help pl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406770#M201825</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This script with filename as parameter&lt;BR /&gt;&lt;BR /&gt;file=$1&lt;BR /&gt;sort -u $file|while read line&lt;BR /&gt;do&lt;BR /&gt;echo "$line"" "$(grep "$line" $file|wc -l)&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;For scripting see&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.shelldorado.com/" target="_blank"&gt;http://www.shelldorado.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;              Steve Steel</description>
      <pubDate>Mon, 25 Oct 2004 03:15:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406770#M201825</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2004-10-25T03:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: ShellScript help pl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406771#M201826</link>
      <description>Steve's answer's perfectly correct as long as that's the exact format of your file.  If you can have a file which has:&lt;BR /&gt;&lt;BR /&gt;1 a&lt;BR /&gt;1 a&lt;BR /&gt;1 b&lt;BR /&gt;1 c&lt;BR /&gt;1 a&lt;BR /&gt;1 a&lt;BR /&gt;1 b&lt;BR /&gt;&lt;BR /&gt;and *still* want &lt;BR /&gt;&lt;BR /&gt;1 a 4&lt;BR /&gt;1 b 2&lt;BR /&gt;1 c 1&lt;BR /&gt;&lt;BR /&gt;then use&lt;BR /&gt;&lt;BR /&gt;cat &lt;FILE&gt; | sort -n | uniq -c | awk '{ print $2 " " $3 " " $1 }'&lt;/FILE&gt;</description>
      <pubDate>Mon, 25 Oct 2004 04:13:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406771#M201826</guid>
      <dc:creator>Stuart Whitby</dc:creator>
      <dc:date>2004-10-25T04:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: ShellScript help pl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406772#M201827</link>
      <description>or&lt;BR /&gt;&lt;BR /&gt;# perl -ne'$x{$_}++}END{for(sort keys%x){s/$/ $x{$_}/;print}' file&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 25 Oct 2004 05:48:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406772#M201827</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-10-25T05:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: ShellScript help pl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406773#M201828</link>
      <description>and finally, in case you need some further data massaging along the lines (sic), here is an awk solution for a sorted file:&lt;BR /&gt;&lt;BR /&gt;awk 'BEGIN {getline x}{i++;if (x!=$0) {print x,i;i=0;x=$0}} END {print x, ++i}' sorted_input&lt;BR /&gt;&lt;BR /&gt;BEGIN - preset last seen record value&lt;BR /&gt;loop  - always count. if new value not equal to old then: print value &amp;amp;count and reset value &amp;amp; count&lt;BR /&gt;END - print final value &amp;amp; count&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Oct 2004 06:44:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406773#M201828</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-10-25T06:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: ShellScript help pl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406774#M201829</link>
      <description>sort filename | uniq -c | sed -e 's:\([0-9][0-9]*\)\([ ][ ]*\)\(.*\)$:\3\2\1:'</description>
      <pubDate>Mon, 25 Oct 2004 09:24:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406774#M201829</guid>
      <dc:creator>Rangarajan Radhakrishna</dc:creator>
      <dc:date>2004-10-25T09:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: ShellScript help pl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406775#M201830</link>
      <description>Hi Stuart &lt;BR /&gt;&lt;BR /&gt;Steve's Solution works perfectly in all cases. It works in your file as well ashwin's file&lt;BR /&gt;&lt;BR /&gt;Singaram</description>
      <pubDate>Tue, 26 Oct 2004 10:43:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shellscript-help-pl/m-p/3406775#M201830</guid>
      <dc:creator>Singaram</dc:creator>
      <dc:date>2004-10-26T10:43:10Z</dc:date>
    </item>
  </channel>
</rss>

