Email address obfuscation in effect -- please
click here to turn it off.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
I have been using 'sort' to sort files that contain numbers aligned in
columns. Here is a very simple example:
1
2
10
On Solaris, sort will order lines as above. On the other hand, GNU sort
orders the lines like this:
1
10
2
Now I read this in the GNU sort man page:
*** WARNING *** The locale specified by the environment affects sort
order. Set LC_ALL=C to get the traditional sort order that uses native
byte values.
So I did this in my tcsh shell...
setenv LC_ALL C
...and suddenly sort is working the way I want it to!
Now here's the annoyance part of it (as if that wasn't annoying
enough!)... I have written a C program that calls sort from the system to
process some data. But it looks like the functioning of 'sort' will
depend on environment variables. Is it possible to write the C program so
that LC_ALL is set to C when sort is called? Do you have any other ideas
on how to handle this problem? (I could use "sort -n" with some
additional arguments to control sort keys, but those sorting-key arguments
vary with the unix OS.)
Thanks in advance for any tips!
Mike
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members