Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort: fails to strip list #290

Closed
sdsddsd1 opened this issue Jul 22, 2021 · 2 comments
Closed

sort: fails to strip list #290

sdsddsd1 opened this issue Jul 22, 2021 · 2 comments

Comments

@sdsddsd1
Copy link

Hey,
I have a given directory structure where I need to strip everything but one toplevel. The sort from toybox somehow fails this operation. Tested also with busybox, sbase and coreutils which all show the right result.

/tmp $ tree testing/                                                               
testing/
├── 1
│   ├── test1
│   └── test2
├── 2
│   ├── test3
│   └── test4
├── 3
│   ├── test5
│   └── test6
└── 4

10 directories, 0 files

'sort' from busybox does the right result. Strip every toplevel but one.

/tmp $ find testing | /home/claudia/bin/busybox sort -ut / -k1,1 
testing

'sort' from toybox does not filter the toplevel directories.

/tmp $ find testing | /usr/bin/toybox  sort -ut / -k1,1                            
testing
testing/1
testing/1/test1
testing/1/test2
testing/2
testing/2/test3
testing/2/test4
testing/3
testing/3/test5
testing/3/test6
testing/4
@gregschmit
Copy link

Is the issue that -u should be using the first field (defined because -t / is specified) as the unique index? Perhaps right now -u is always using the whole line as the unique index and we just need it to respect that -k1,1 indicates to use the first field as the uniqueness index?

@landley
Copy link
Owner

landley commented Jan 4, 2022

The issue was that (according to posix) -u should enable -s. Try now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants