I have to sort before I remove the lines at the top because the lines that
have the zeros in column 5 are not at the top.  The whole point of the task
is not to sort the data, but to filter unneeded data.  Some zeroes in
column 5 are okay, but the redundant ones are the ones at the top after
sorting by col 4 then by col 3.

The columns are tab delimited, then the entries are right justified using
spaces.

TIA.

- Bryan

__________________


Bryan R Harris wrote:
>
> I suppose it does look a little bizarre.  Actually, my goal is a little
> more complex.  We have a simulation that outputs data files, but often up
> to 90% of the data is redundant.  So I'm trying to write a filter for the
> data.  I have to:
>
> 1.  open and load the file
> 2.  strip all comments (marked with a #) and blank lines off the top
> 3.  sort by column 4, then by column 3
> 4.  remove all lines at the top that have a 0 in column 5
> 5.  write the comments + sorted lines back out to a new file

I would change the order to:

1.  open and load the file
2.  strip all comments (marked with a #) and blank lines off the top
3.  remove all lines at the top that have a 0 in column 5
4.  sort by column 4, then by column 3
5.  write the comments + sorted lines back out to a new file

Why sort something that you are going to remove anyway?

> Unfortunately I'm new enough at perl that I've only got steps 1 and 2 to
> work so far...  I got some great help here on the list for step 3, though
> the code at

(URL for analysis of Schwartzian Transform by tchrist)

> seems much more concise.  I just haven't gotten it to work on my array
> instead of a string.

How are your columns defined?  Fixed width?  Space separated?


John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to