<?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: A script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768270#M657633</link>
    <description>&lt;!--!*#--&gt;      man uniq&lt;BR /&gt;      man sort&lt;BR /&gt;&lt;BR /&gt;alp$ &amp;lt; 1474162.txt tr ',' '\n' | sort | uniq&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;cc&lt;BR /&gt;dd&lt;BR /&gt;ee&lt;BR /&gt;ff&lt;BR /&gt;zz&lt;BR /&gt;alp$&lt;BR /&gt;&lt;BR /&gt;Try it first without the "| uniq".</description>
    <pubDate>Tue, 22 Mar 2011 08:18:37 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2011-03-22T08:18:37Z</dc:date>
    <item>
      <title>A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768265#M657628</link>
      <description>I have a file , the file as below ,&lt;BR /&gt;&lt;BR /&gt;aa,bb,cc&lt;BR /&gt;aa,cc,dd&lt;BR /&gt;cc,dd,ee&lt;BR /&gt;ff,zz&lt;BR /&gt;dd,aa&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the file have many lines, and the content may be duplicated and separated by "," sign . Now if I want to erase some contents in the file &lt;BR /&gt;&lt;BR /&gt;1) if the content is duplicate , then output 1 time &lt;BR /&gt;2) the result should be in 1 line.&lt;BR /&gt;&lt;BR /&gt;so my desired output is &lt;BR /&gt;&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;cc&lt;BR /&gt;dd&lt;BR /&gt;ee&lt;BR /&gt;ff&lt;BR /&gt;zz&lt;BR /&gt;&lt;BR /&gt;can advise what can i do ? thx&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Mar 2011 04:55:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768265#M657628</guid>
      <dc:creator>ivy1234</dc:creator>
      <dc:date>2011-03-22T04:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768266#M657629</link>
      <description>ivy,&lt;BR /&gt;&lt;BR /&gt;check this out:&lt;BR /&gt;&lt;BR /&gt;$ cat file | tr "," "\n" | uniq -u&lt;BR /&gt;&lt;BR /&gt;Hth,&lt;BR /&gt;Raj.</description>
      <pubDate>Tue, 22 Mar 2011 05:26:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768266#M657629</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2011-03-22T05:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768267#M657630</link>
      <description>thx ,&lt;BR /&gt;&lt;BR /&gt;but it do not handle duplicate case , that mean the output is deplicate , &lt;BR /&gt;&lt;BR /&gt;can advise if I want if the data is duplicated then do not output the same data , what can i do ? thx</description>
      <pubDate>Tue, 22 Mar 2011 06:24:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768267#M657630</guid>
      <dc:creator>ivy1234</dc:creator>
      <dc:date>2011-03-22T06:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768268#M657631</link>
      <description>thx &lt;BR /&gt;&lt;BR /&gt;the  |uniq -u seems not work in this case.</description>
      <pubDate>Tue, 22 Mar 2011 06:30:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768268#M657631</guid>
      <dc:creator>ivy1234</dc:creator>
      <dc:date>2011-03-22T06:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768269#M657632</link>
      <description>ivy,&lt;BR /&gt;You can use uniq -c and cut the numeric first field,&lt;BR /&gt;&lt;BR /&gt;$ cat file | tr "," "\n" | uniq -c | cut -c 1-2&lt;BR /&gt;&lt;BR /&gt;I cant check it now, as don't hv system now.&lt;BR /&gt;Hth,&lt;BR /&gt;Raj.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Mar 2011 08:15:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768269#M657632</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2011-03-22T08:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768270#M657633</link>
      <description>&lt;!--!*#--&gt;      man uniq&lt;BR /&gt;      man sort&lt;BR /&gt;&lt;BR /&gt;alp$ &amp;lt; 1474162.txt tr ',' '\n' | sort | uniq&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;cc&lt;BR /&gt;dd&lt;BR /&gt;ee&lt;BR /&gt;ff&lt;BR /&gt;zz&lt;BR /&gt;alp$&lt;BR /&gt;&lt;BR /&gt;Try it first without the "| uniq".</description>
      <pubDate>Tue, 22 Mar 2011 08:18:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768270#M657633</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-03-22T08:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768271#M657634</link>
      <description>&lt;BR /&gt;For 'uniq' to work the stream has to be sorted first&lt;BR /&gt;&lt;BR /&gt;Man...&lt;BR /&gt;"DESCRIPTION&lt;BR /&gt;       Discard  all  but one of successive identical lines from INPUT"&lt;BR /&gt;&lt;BR /&gt;Here the solution with "tr | sort | uniq" probably works just fine.&lt;BR /&gt; &lt;BR /&gt;For modest dataset you may also want to play with PERL to allow for more tricky splitting, parsing, counting and printing.&lt;BR /&gt; &lt;BR /&gt;In this simple example we can set up an array value for each word found and at the end ( eskimo kiss: }{   :-) print all the keys thus established&lt;BR /&gt;&lt;BR /&gt;$ perl -lne '$x{$_}=1 for split /,/ } { print for (sort keys %x) ' x.txt&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;cc&lt;BR /&gt;dd&lt;BR /&gt;ee&lt;BR /&gt;ff&lt;BR /&gt;zz&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Mar 2011 11:26:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768271#M657634</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2011-03-22T11:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768272#M657635</link>
      <description>Ivy, &lt;BR /&gt;Here you go with awk,&lt;BR /&gt;# cat file | tr "," "\n" | awk '!x[$0]++'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;cc&lt;BR /&gt;dd&lt;BR /&gt;ee&lt;BR /&gt;ff&lt;BR /&gt;zz&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have fun! Remember to assign points to all posts,&lt;BR /&gt;Raj.&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Mar 2011 18:17:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768272#M657635</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2011-03-22T18:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768273#M657636</link>
      <description>Raj is still missing the point. uniq only senses consecutive lines which were duplicates&lt;BR /&gt;&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;bb&lt;BR /&gt;&lt;BR /&gt;ran thru uniq, will generate:&lt;BR /&gt;&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;&lt;BR /&gt;not&lt;BR /&gt;&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;&lt;BR /&gt;the one liner should be something like this:&lt;BR /&gt;&lt;BR /&gt;cat file | tr "," "\n" | sort | uniq&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Mar 2011 18:41:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768273#M657636</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2011-03-22T18:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768274#M657637</link>
      <description>&lt;!--!*#--&gt;&amp;gt; cat file | tr "," "\n" | sort | uniq&lt;BR /&gt;&lt;BR /&gt;Geez.  Why didn't _I_ think of that.  No,&lt;BR /&gt;wait...&lt;BR /&gt;&lt;BR /&gt;And my version lacked the (much hated) "cat".&lt;BR /&gt;And, when picoseconds count, I figure that&lt;BR /&gt;'x' should be faster than "x" -- no looking&lt;BR /&gt;for dollar signs in 'x'.</description>
      <pubDate>Tue, 22 Mar 2011 19:01:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768274#M657637</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-03-22T19:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768275#M657638</link>
      <description>&amp;gt;Steven: ... | sort | uniq&lt;BR /&gt;&lt;BR /&gt;You can optimize this by using "sort -u".</description>
      <pubDate>Wed, 23 Mar 2011 04:10:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768275#M657638</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-03-23T04:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768276#M657639</link>
      <description>Mel, thanks good thing leaned abt uniq, &lt;BR /&gt;, uniq only senses consecutive lines which were duplicates. sometime I used to wonder why uniq not working properly, now it make sense, t u.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Mar 2011 04:57:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768276#M657639</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2011-03-23T04:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768277#M657640</link>
      <description>cat file | tr ',' '\n'|sort -u&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Wed, 23 Mar 2011 07:18:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768277#M657640</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2011-03-23T07:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: A script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768278#M657641</link>
      <description># cat file|tr "," "\n" | awk '!x[$0]++' #Enjoy!.&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Mar 2011 07:47:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-script/m-p/4768278#M657641</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2011-03-23T07:47:21Z</dc:date>
    </item>
  </channel>
</rss>

