Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I agree with the moral of the story. However, you were not completely off on your idea to condense to 1 statement. Using your test, the following works:
sort -n -t, -k1,1 -k2,2 -u test.dat Sort needs to look at the 2 fields independently. I used to do a lot of shell scripting, and sort was a frequent tool. The other thing to watch for is some systems (difference between Sequent DYNIX and HP/UX that I know of) requires '-t ,' and others '-t,'. If you don't get it right on your system, sort acts very strange. None of this is documented well, that I've seen. As someone else put it, "Unit Test, Unit Test, Unit Test". I very frequently, will do the test you did BEFORE implementing a change, just to verify my understanding of how things work.... While we are giving advice: Never believe a customer/user when they say "always" or "never".... In reply to Re: If it's not broken, don't fix it
by MungeMeister
|
|