<?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: script help in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063795#M94573</link>
    <description>&lt;!--!*#--&gt;Well, the "best" answer is the one you come up with and this is so simple you should really do it yourself. Here's one approach using uniq -c which will output the number of identical lines plus the line itself.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset -i N=0&lt;BR /&gt;typeset -i I=0&lt;BR /&gt;typeset -i MAX=5 # max repeats&lt;BR /&gt;typeset S=''&lt;BR /&gt;typeset INFILE="myinfile"&lt;BR /&gt;&lt;BR /&gt;uniq -c ${INFILE} | while read N S&lt;BR /&gt;  do&lt;BR /&gt;     I=1&lt;BR /&gt;     if [[ ${N} -gt ${MAX} ]]&lt;BR /&gt;       then&lt;BR /&gt;         N=${MAX}&lt;BR /&gt;       fi&lt;BR /&gt;     while [[ ${I} -le ${N} ]]&lt;BR /&gt;       do&lt;BR /&gt;         echo "${S}"&lt;BR /&gt;         ((I += 1))&lt;BR /&gt;       done&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 31 Aug 2007 12:52:27 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2007-08-31T12:52:27Z</dc:date>
    <item>
      <title>script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063793#M94571</link>
      <description>I'm trying to break the loop and continue with the next line:&lt;BR /&gt;&lt;BR /&gt;the file has 10 lines of the record (f1), I want to break when it reaches 5 and continue with the next line (f2) and so on.&lt;BR /&gt;&lt;BR /&gt;what is the best way to do it?&lt;BR /&gt;10 points for the best answer.&lt;BR /&gt;&lt;BR /&gt;f1&lt;BR /&gt;f1&lt;BR /&gt;f1&lt;BR /&gt;f1&lt;BR /&gt;f1&lt;BR /&gt;f1&lt;BR /&gt;f1&lt;BR /&gt;f1&lt;BR /&gt;f1&lt;BR /&gt;f1&lt;BR /&gt;fi&lt;BR /&gt;f2&lt;BR /&gt;f2&lt;BR /&gt;f3&lt;BR /&gt;f3&lt;BR /&gt;f3&lt;BR /&gt;f3&lt;BR /&gt;f3&lt;BR /&gt;f3&lt;BR /&gt;f3&lt;BR /&gt;f3&lt;BR /&gt;f3&lt;BR /&gt;f3&lt;BR /&gt;f3&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2007 12:29:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063793#M94571</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-08-31T12:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063794#M94572</link>
      <description>for x in file1 \&lt;BR /&gt;         file2&lt;BR /&gt;do&lt;BR /&gt;        awk 'NR &amp;lt; 6 {print}' $x&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2007 12:46:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063794#M94572</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2007-08-31T12:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063795#M94573</link>
      <description>&lt;!--!*#--&gt;Well, the "best" answer is the one you come up with and this is so simple you should really do it yourself. Here's one approach using uniq -c which will output the number of identical lines plus the line itself.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset -i N=0&lt;BR /&gt;typeset -i I=0&lt;BR /&gt;typeset -i MAX=5 # max repeats&lt;BR /&gt;typeset S=''&lt;BR /&gt;typeset INFILE="myinfile"&lt;BR /&gt;&lt;BR /&gt;uniq -c ${INFILE} | while read N S&lt;BR /&gt;  do&lt;BR /&gt;     I=1&lt;BR /&gt;     if [[ ${N} -gt ${MAX} ]]&lt;BR /&gt;       then&lt;BR /&gt;         N=${MAX}&lt;BR /&gt;       fi&lt;BR /&gt;     while [[ ${I} -le ${N} ]]&lt;BR /&gt;       do&lt;BR /&gt;         echo "${S}"&lt;BR /&gt;         ((I += 1))&lt;BR /&gt;       done&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2007 12:52:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063795#M94573</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-08-31T12:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063796#M94574</link>
      <description>&lt;!--!*#--&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;With a pure shell script:&lt;BR /&gt;&lt;BR /&gt;# #!/usr/bin/sh&lt;BR /&gt;while read LINE&lt;BR /&gt;do&lt;BR /&gt;   [ -z "${SAVE}" ] &amp;amp;&amp;amp; SAVE=${LINE}&lt;BR /&gt;   if [ "${LINE}" = ${SAVE} ]; then&lt;BR /&gt;       let i=i+1&lt;BR /&gt;       [ ${i} -ge 5 ] &amp;amp;&amp;amp; continue || echo ${LINE}&lt;BR /&gt;   else&lt;BR /&gt;       i=0&lt;BR /&gt;       SAVE=${LINE}&lt;BR /&gt;       echo ${LINE}&lt;BR /&gt;   fi&lt;BR /&gt;done &amp;lt; file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 31 Aug 2007 12:54:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063796#M94574</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-31T12:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063797#M94575</link>
      <description>Hi (again(:&lt;BR /&gt;&lt;BR /&gt;Oops, that shebank line (line-1) should of course be:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;...not:&lt;BR /&gt;&lt;BR /&gt;# #!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2007 12:57:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063797#M94575</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-31T12:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063798#M94576</link>
      <description>Hi (again(:&lt;BR /&gt;&lt;BR /&gt;Oops, that shebang line (line-1) should of course be:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;...not:&lt;BR /&gt;&lt;BR /&gt;# #!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2007 12:57:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063798#M94576</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-31T12:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063799#M94577</link>
      <description>James&lt;BR /&gt;&lt;BR /&gt;yours is good but it coninues to count the lines before it gets to the next string.&lt;BR /&gt;Is there away to avoid counting the lines and just skip to the next string?</description>
      <pubDate>Fri, 31 Aug 2007 14:28:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063799#M94577</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-08-31T14:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063800#M94578</link>
      <description>&amp;gt;&amp;gt; Is there away to avoid counting the lines and just skip to the next string?&lt;BR /&gt;&lt;BR /&gt;Think about what you are asking. Do you know of a "skip to the next (different) string" command? How would you write such a command without reading the intervening data?&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2007 14:47:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063800#M94578</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-08-31T14:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063801#M94579</link>
      <description>.</description>
      <pubDate>Fri, 31 Aug 2007 16:10:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063801#M94579</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-08-31T16:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063802#M94580</link>
      <description>&amp;gt;Clay: Do you know of a "skip to the next (different) string" command? How would you write such a command without reading the intervening data?&lt;BR /&gt;&lt;BR /&gt;You just ask the index sequential file to skip to a record with a key greater than the current key.  :-)</description>
      <pubDate>Fri, 31 Aug 2007 22:05:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063802#M94580</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-31T22:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063803#M94581</link>
      <description>Dennis,&lt;BR /&gt;&lt;BR /&gt;Would you mind to elaborate?&lt;BR /&gt;</description>
      <pubDate>Sat, 01 Sep 2007 00:41:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063803#M94581</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-09-01T00:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063804#M94582</link>
      <description>If I understand you correctly, &lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset -i I=0&lt;BR /&gt;typeset -i MAX=5&lt;BR /&gt;PREV=""&lt;BR /&gt;cat FILE | while read CURR; do&lt;BR /&gt;     if [ $CURR != $PREV ]; then&lt;BR /&gt;        I=1&lt;BR /&gt;        echo $CURR&lt;BR /&gt;        PREV=CURR&lt;BR /&gt;     else&lt;BR /&gt;        if [ $I -le $MAX ] ; then&lt;BR /&gt;           echo $CURR&lt;BR /&gt;           I=$I+1&lt;BR /&gt;         fi&lt;BR /&gt;      fi&lt;BR /&gt;done</description>
      <pubDate>Sat, 01 Sep 2007 01:08:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063804#M94582</guid>
      <dc:creator>Victor Fridyev</dc:creator>
      <dc:date>2007-09-01T01:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063805#M94583</link>
      <description>In COBOL an Indexed file allows you to find records by a key.  You can also find records by a key greater than the one you supply.  Once you find the record, you can do sequential reads of the records in order.&lt;BR /&gt;&lt;BR /&gt;Of course the file has to have some type of B tree to contain the keys and records and allow these quick searches.&lt;BR /&gt;&lt;BR /&gt;So you would basically do:&lt;BR /&gt;1) READ and after 5 matches then:&lt;BR /&gt;2) START key &amp;gt; current key&lt;BR /&gt;3) repeat at 1)&lt;BR /&gt;&lt;BR /&gt;Since you don't have COBOL, you would have to do what Clay said, skip matching records until you come to a difference.&lt;BR /&gt;&lt;BR /&gt;So unless you have 1000s of records to skip, you should just read and compare.</description>
      <pubDate>Sat, 01 Sep 2007 01:10:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063805#M94583</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-09-01T01:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063806#M94584</link>
      <description>&amp;gt;JRF: With a pure shell script:&lt;BR /&gt;&lt;BR /&gt;You forgot to initialize "i".  And if you do, you only print 4 of the first group.  So why did you have "[ -z "${SAVE}" ]"?&lt;BR /&gt;It seems you want SAVE to be empty so you go though the difference code like Victor.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Victor:  PREV=CURR&lt;BR /&gt;&lt;BR /&gt;Typo, you forgot a "$" before CURR.</description>
      <pubDate>Sat, 01 Sep 2007 01:34:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063806#M94584</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-09-01T01:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063807#M94585</link>
      <description>&lt;!--!*#--&gt;Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Dennis: JRF, You forgot to initialize "i". And if you do, you only print 4 of the first group. &lt;BR /&gt;&lt;BR /&gt;Yes, you're correct - sloppy logic on my part and in fact running with 'sh -x' exposes that.  The script should look like:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset -i i=0&lt;BR /&gt;while read LINE&lt;BR /&gt;do&lt;BR /&gt;   [ -z "${SAVE}" ] &amp;amp;&amp;amp; SAVE=${LINE}&lt;BR /&gt;   if [ "${LINE}" = ${SAVE} ]; then&lt;BR /&gt;       let i=i+1&lt;BR /&gt;       [ ${i} -gt 5 ] &amp;amp;&amp;amp; continue || echo ${LINE}&lt;BR /&gt;   else&lt;BR /&gt;       i=1&lt;BR /&gt;       SAVE=${LINE}&lt;BR /&gt;       echo ${LINE}&lt;BR /&gt;   fi&lt;BR /&gt;done &amp;lt; file&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ALSO:&lt;BR /&gt;&lt;BR /&gt;Dennis&amp;gt;: In COBOL an Indexed file allows you to find records by a key.&lt;BR /&gt;&lt;BR /&gt;Yes, that's true, but B-trees, and hashes are more germane under the assumption that the file was built with the intention of searches like this question posed. ;-)&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Sat, 01 Sep 2007 11:30:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063807#M94585</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-09-01T11:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063808#M94586</link>
      <description>You guys are awesome!&lt;BR /&gt;&lt;BR /&gt;Dennis,&lt;BR /&gt;&lt;BR /&gt;Yes, some lines are over 1000 lines and that is why I kept asking if there is away to skip them. It'll take forever before I get the final result.&lt;BR /&gt;Sorry if my question sounds stupid but I'd really appreciate any help.&lt;BR /&gt;If the shell can not do it, can Perl do it then?&lt;BR /&gt;</description>
      <pubDate>Sat, 01 Sep 2007 11:44:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063808#M94586</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-09-01T11:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063809#M94587</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; some lines are over 1000 lines and that is why I kept asking if there is away to skip them. It'll take forever before I get the final result.&lt;BR /&gt;&lt;BR /&gt;Are you saying that your file is static in its contents but that you repeatedly want to search it?&lt;BR /&gt;&lt;BR /&gt;If that's true then you could build a hash (index) as a separate file.  The index (file) would contain the offset of the first record of each "block" of similar data (akin to what your example shows).  Using the index file, you find the key you want in the index; read the offset stored there associated with the key; and using that offset, seek() to the correct position in the data file.  While a pure shell script can't do this, Perl can.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 01 Sep 2007 12:49:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063809#M94587</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-09-01T12:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063810#M94588</link>
      <description>&amp;gt;It'll take forever before I get the final result.&lt;BR /&gt;&lt;BR /&gt;How many total lines?  And you want to visit only the first 5 of each set?&lt;BR /&gt;&lt;BR /&gt;If your data is more dynamic, it would have to be sorted, there you could make that index.&lt;BR /&gt;(How does the file get sorted?&lt;BR /&gt;&lt;BR /&gt;Or you could just binary search forward in a C program to your guess where the next group starts.&lt;BR /&gt;&lt;BR /&gt;Or in C++, create a multimap.</description>
      <pubDate>Sat, 01 Sep 2007 18:05:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063810#M94588</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-09-01T18:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063811#M94589</link>
      <description>1,000 - 100,000 dups is probably not worth your time not the computer time to try and 'jump' over. Just read and compare.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;For better help, please indicate &lt;BR /&gt;- an approximate total record count&lt;BR /&gt;- whether records as fixed length (allowing for binary search, or jump aheads'.&lt;BR /&gt;- do all bytes of each record contribute to uniqueness?&lt;BR /&gt;- what data (counters) do you want to retain as well (records, dups, selected,..?)&lt;BR /&gt;&lt;BR /&gt;If the skip-ahead was really imporant then I would do something like:&lt;BR /&gt;After N dups, seek ahead an other N dups.&lt;BR /&gt;Start with 4.&lt;BR /&gt;Repeat if still dup.&lt;BR /&gt;Binary search backwards if when jumped too far.&lt;BR /&gt;So within a 10,000 sup series you might read: 1,2,3,4,8,32,64,128,256,512,1024,2048,4096,8192,16384,&lt;BR /&gt;12288,10240,9216,9728,9984,10112,10048,10016,10000&lt;BR /&gt;&lt;BR /&gt;So that's a good 25 reads to count 10,000,&lt;BR /&gt;and only 2 more for every 2 times as many records.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I guess I'll also have to do the obligatory Perl alternatives!  :-)&lt;BR /&gt;&lt;BR /&gt;# perl -ne 'print if $test{$_}++ &amp;lt; 5' &lt;FILE&gt;&lt;BR /&gt;&lt;BR /&gt;The above does NOT require sorted input.&lt;BR /&gt;&lt;BR /&gt;As written it uses the whole line to indicate uniqueness, but it is readily modified to just use a substring or field.&lt;BR /&gt;&lt;BR /&gt;It will gobble up memory per unique line.&lt;BR /&gt;It will be fine for up to 100,000 lines, but might become problematic for millions (of uniques records).&lt;BR /&gt;&lt;BR /&gt;What problem are you really trying to solve?&lt;BR /&gt;&lt;BR /&gt;I looks like the requested task will lose a lot of info but doen not at much value.&lt;BR /&gt;&lt;BR /&gt;Don't you want to know how many there where?&lt;BR /&gt;IF SORTED, no memory consumption:&lt;BR /&gt;&lt;BR /&gt;$ perl -ne 'if ($last ne $_){ print "($n)\n" if $n&amp;gt;5; $last=$_; $n=0; print} else {print if $n++ &amp;lt;&lt;BR /&gt;5}' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;Don't you want at least an indication there where more than 5?&lt;BR /&gt;&lt;BR /&gt;$ perl -ne 'print if (($x=$test{$_}++) &amp;lt; 5); print ":\n" if 6==$x' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps some,&lt;BR /&gt;Hein van den Heuvel (at gmail dot com)&lt;BR /&gt;HvdH Performance Consulting&lt;BR /&gt;&lt;/FILENAME&gt;&lt;/FILENAME&gt;&lt;/FILE&gt;</description>
      <pubDate>Sun, 02 Sep 2007 12:32:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063811#M94589</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-09-02T12:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063812#M94590</link>
      <description>&amp;gt;Hein: - whether records as fixed length (allowing for binary search, or jump aheads&lt;BR /&gt;&lt;BR /&gt;Even if not fixed, you can do fuzzy skips by throwing away the partial record.</description>
      <pubDate>Sun, 02 Sep 2007 13:23:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/4063812#M94590</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-09-02T13:23:05Z</dc:date>
    </item>
  </channel>
</rss>

