problem wth sort utility?

JD jd1008 at gmail.com
Thu Jun 30 19:04:14 UTC 2011


On 07/01/2011 12:00 AM, Michael D. Setzer II wrote:
> I'm getting results that I don't expect and different from busybox
> sort?
>
> The file contains partition infomation
> [======DISK======] [=============NAME==============]
> [====SIZE====] [MAJ] [MIN]
> [sda             ] [Hitachi HDP72505               ] [   465.76 GB] [  8] [
> 0]
>
> [=====DEVICE=====] [==FILESYS==] [======LABEL======]
> [====SIZE====] [MAJ] [MIN]
> [sda1            ] [ext3       ] [<unknown>         ] [   200.00 MB] [  8] [
> 1]
> [sda2            ] [LVM2_member] [<unknown>         ] [    31.18 GB] [
> 8] [  2]
> [sda3            ] [ext3       ] [<unknown>         ] [   434.38 GB] [  8] [  3]
> [dm-0            ] [ext4       ] [<unknown>         ] [    25.87 GB] [253] [
> 0]
> [dm-1            ] [swap       ] [<unknown>         ] [     5.31 GB] [253] [
> 1]
>
> When I use the Fedora 14 sort I get this.
>
> [=====DEVICE=====] [==FILESYS==] [======LABEL======]
> [====SIZE====] [MAJ] [MIN]
> [======DISK======] [=============NAME==============]
> [====SIZE====] [MAJ] [MIN]
> [dm-0            ] [ext4       ] [<unknown>         ] [    25.87 GB] [253] [
> 0]
> [dm-1            ] [swap       ] [<unknown>         ] [     5.31 GB] [253] [
> 1]
> [sda1            ] [ext3       ] [<unknown>         ] [   200.00 MB] [  8] [
> 1]
> [sda2            ] [LVM2_member] [<unknown>         ] [    31.18 GB] [
> 8] [  2]
> [sda3            ] [ext3       ] [<unknown>         ] [   434.38 GB] [  8] [  3]
> [sda             ] [Hitachi HDP72505               ] [   465.76 GB] [  8] [
> 0]
>
> Which is not what I expect with sda coming at the end instead of
> before sda1, and there are just spaces between all the charcters,
> no special codes.
>
> Using busybox sort results in this.
>
> [======DISK======] [=============NAME==============]
> [====SIZE====] [MAJ] [MIN]
> [=====DEVICE=====] [==FILESYS==] [======LABEL======]
> [====SIZE====] [MAJ] [MIN]
> [dm-0            ] [ext4       ] [<unknown>         ] [    25.87 GB] [253] [
> 0]
> [dm-1            ] [swap       ] [<unknown>         ] [     5.31 GB] [253] [
> 1]
> [sda             ] [Hitachi HDP72505               ] [   465.76 GB] [  8] [
> 0]
> [sda1            ] [ext3       ] [<unknown>         ] [   200.00 MB] [  8] [
> 1]
> [sda2            ] [LVM2_member] [<unknown>         ] [    31.18 GB] [
> 8] [  2]
> [sda3            ] [ext3       ] [<unknown>         ] [   434.38 GB] [  8] [  3]
>
> Which is what I expect?
> If I create a file with just the disk and partition info, both sorts give
> me the correct sorts. Even if I put spaces afterwards it sorts fine,
> but if I put non-blanks it puts the sda at the end?
>
> Any ideals on why sort is acting this way?
>
>
> +----------------------------------------------------------+
>    Michael D. Setzer II -  Computer Science Instructor
>    Guam Community College  Computer Center
>    mailto:mikes at kuentos.guam.net
>    mailto:msetzerii at gmail.com
>    http://www.guam.net/home/mikes
>    Guam - Where America's Day Begins
>    G4L Disk Imaging Project maintainer
>    http://sourceforge.net/projects/g4l/
> +----------------------------------------------------------+
>
> http://setiathome.berkeley.edu (Original)
> Number of Seti Units Returned:  19,471
> Processing time:  32 years, 290 days, 12 hours, 58 minutes
> (Total Hours: 287,489)
>
> BOINC at HOME CREDITS
> SETI        10944149.476033   |   EINSTEIN     6108721.330851
> ROSETTA      3318509.748210   |   ABC          6642219.200443
>
Can you post your entire sort command with it's args in both cases?


More information about the users mailing list