Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^7: perllocale weirdness, bug, or...?

by choroba (Canon)
on Oct 22, 2010 at 11:21 UTC ( #866787=note: print w/ replies, xml ) Need Help??


in reply to Re^6: perllocale weirdness, bug, or...?
in thread perllocale weirdness, bug, or...?

You should use sort -k1,1 to make sort ignore the rest of the line.


Comment on Re^7: perllocale weirdness, bug, or...?
Download Code
Re^8: perllocale weirdness, bug, or...?
by Krambambuli (Deacon) on Oct 22, 2010 at 12:20 UTC
    Thanks for the tip - I really hoped it might solve the issue, but unfortunately it does not.

    For the file test.txt (TAB separated fields) being
    a_2 2 a2 1
    I still get
    $ sort -k 1,1 test.txt | cut -f 1 a2 a_2
    whereas when there is no second field then the result is reversed,
    a_2 a2
    Looks like the problem 'survives'.
    ---
      Looks like two level sort: on the first level, it ignores the _, but if the strings are different only thanks to the underscore, it is used in the second level.
      $ echo $'a_2\t2\na2\t1' | sort -k1 a2 1 a_2 2 $ echo $'a_2\t2\na2\t1' | sort -k1,1 a2 1 a_2 2 $ echo $'a2\t2\na_2\t1' | sort -k1,1 a2 2 a_2 1 $ echo $'a2\t2\na_2\t1' | sort -k1 a_2 1 a2 2

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://866787]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2015-07-06 01:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (69 votes), past polls