in reply to Re: col-uniq -- remove lines that match on selected column(s)
in thread col-uniq -- remove lines that match on selected column(s)
As for your second point, it's true the code as originally posted could lead to an "out of memory" condition, if it got a very long stream of repeated lines. But I wanted an array that I could "pop" or "shift" off of in order to print a duplicate line only once. So to fix the possible memory consumption problem, instead of "pushing" onto the array every time there's a duplication, I just make sure the array never contains more than one element (and this happens to be the line that the user wants to see). That made the print statements a lot simpler too, which is nice.
Update: then again, after making that change to how I was using the "heldline" array, I finally realized that it doesn't have to be an array, which is exactly what you said. So I fixed it (and I thank you) again.
|Replies are listed 'Best First'.|
Re^3: col-uniq -- remove lines that match on selected column(s)
by repellent (Priest) on Nov 10, 2008 at 17:49 UTC