-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Recommended way to sort results #196
Comments
What about using > fd -0 foo | xargs -0 ls -ltr |
It works .. so i will close this issue. It would be nice to have a sorting flag that keeps coloring in the output. Or alternatively a flag to execute a command for all the results ( |
@sharkdp Is that still the recommended way? Something like |
@rien333 You are right. I would now recommend to use the |
Add a new `-l`/`--list` option to show more details about the search results. This is basically an alias for `--exec-batch ls -l` with some additional `ls` options. This can be used in order to: * see metadata like permissions, owner, file size, modification times (#491) * see symlink targets (#482) * achieve a determinstic output order (#324, #196, #159) * avoid duplicate search results when multiple search paths are given (#405)
Add a new `-l`/`--list` option to show more details about the search results. This is basically an alias for `--exec-batch ls -l` with some additional `ls` options. This can be used in order to: * see metadata like permissions, owner, file size, modification times (#491) * see symlink targets (#482) * achieve a deterministic output order (#324, #196, #159) * avoid duplicate search results when multiple search paths are given (#405)
Add a new `-l`/`--list` option to show more details about the search results. This is basically an alias for `--exec-batch ls -l` with some additional `ls` options. This can be used in order to: * see metadata like permissions, owner, file size, modification times (#491) * see symlink targets (#482) * achieve a deterministic output order (#324, #196, #159) * avoid duplicate search results when multiple search paths are given (#405)
This has now been released in fd v8.0. |
$ fd -l
[fd error]: 'fd --list-details' is not supported on Windows unless GNU 'ls' is installed. Fail. Still looking for a native way to sort the output in alphabetical order SINCE 2018. |
What's wrong with installing GNU's ls? If a system can acquire and install |
@rien333, yeah, then let's refuse to build the app for other platforms at all, saying that once user is able to download this app, then why not install the whole Unix zoo as well. After all, it's free, it's easy peasy lemon squeezy, it means less troubleshooting and more time for developing new features. Hooray, my eye. Do you know what portability means? I mentioned And most importantly $ fd -H -g "_startup" -l
-rwxrwxrwx 1 somebody somegroup 0 Jan 7 10:03 '.\Autohotkey\_startup'
-rwxrwxrwx 1 somebody somegroup 0 Jan 7 05:28 '.\DNSCrypt\_startup'
-rwxrwxrwx 1 somebody somegroup 0 Jan 7 05:28 '.\Keepass\_startup' What are I need a list of paths in alphabetical order, nothing more. $ fd -H -g "_startup" --sort
Autohotkey\_startup ^ this flag is not implemented yet
DNSCrypt\_startup
Keepass\_startup Since this app outputs paths, it's crucial to provide different popular ways to display these paths. Just like |
I do not think you have explained the connection between
If your OS has no way to the sort/filter lines of output, then this is not even that bad of an idea, especially because that "zoo" of extremely portable utilities is just 16MB in size. My guess, however, is that windows does already have such text manipulation capabilities, making Also, and not sure what it got to do with anything, but I agree that the output of |
The If you don't have Maybe there is some roughly equivalent powershell command it could run instead? But then the output would be very different on windows than other platforms, and would either be different depending on whether you had GNU ls installed, or would never be consistent with other environments (if we always used a powershell command). FWIW, AFAIK, none of the maintainers of fd use Windows, so support of Windows is mostly best-effort. If you think windows support could be improved in some way, PRs are welcome :).
I think the discussion of the
So in your case, assuming that since you are on windows, you are using powershell, you can just pipe the output to It doesn't really add much value over composing fd with existing tools (depending on your operating system) to sort the output. |
Are you suggesting that the output should be parsed again by another command? In that case it is probably better to use
That's precisely the point why the Specifically for the
IMO there is also no relation on the actual usage of the tool. It became connected because this topic is about sorting and sharkdp said:
For me it's also not clear what this has to do with sorting ... IMO this |
Have you read the unix stackexchange link from the OP? Despite the title, the original request for this issue was how to do the equivalent of find . your-options -printf "%T+ %p\n" | sort and note that that still uses sort. The relevance of And yes it does rely on a unix-specific tool. But there probably is a way to do tthe same on windows as well, but I'm not familiar enough with windows to know what that is. |
I am the Original Poster. The stackexchange post was as an example of the kind of functionality i wanted (the outcome) not a specific request to do something with flags and/or pipes.
I agree with you. |
Does anyone have a recommendation for sorting and using an |
If the final program in the chain accepts a list of files as input (which a lot of unix tools to do) you may be able to get away with something like this instead (at least in fish shell): # find all mp3s, sort them, and then call another program (e.g. du) on this sorted list
du -h (fd -emp3 | ... # your sorting routine here) Or a much more ugly approach: du -h (ls -t (fd -emp3)) The above gives you a list of mp3s with their respective size, sorted by their modification date. I think doing this within a single |
You can pipe to sort, then pipe that result to xargs |
I thought the solution is quite clear. ( i use eza instead of ls for ls) $: fd 'Screenshot (F|f)rom.*.png' ~/Pictures/ -X eza -s modified -1 --no-quotes
/home/zw963/Pictures/Screenshot from 2024-12-14 03-25-37.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-25-45.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-26-18.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-27-03.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-27-12.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-27-25.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-29-40.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 03-31-30.png
/home/zw963/Pictures/Screenshots/Screenshot from 2024-12-14 03-32-42.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-33-16.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-34-44.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-35-49.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-36-35.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 03-37-54.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 03-40-55.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-43-01.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-58-01.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 03-58-35.png
/home/zw963/Pictures/Screenshot from 2024-12-14 03-59-22.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 03-59-42.png
/home/zw963/Pictures/Screenshot from 2024-12-14 11-03-02.png
/home/zw963/Pictures/Screenshot from 2024-12-14 11-04-48.png
/home/zw963/Pictures/Screenshot from 2024-12-14 11-08-32.png
/home/zw963/Pictures/Screenshot from 2024-12-14 11-18-09.png
/home/zw963/Pictures/Screenshot from 2024-12-14 11-40-27.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 11-48-32.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 11-50-44.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 12-01-40.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 12-02-27.png
/home/zw963/Pictures/Screenshot from 2024-12-14 12-08-37.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 12-17-37.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 17-55-26.png
/home/zw963/Pictures/Screenshots/Screenshot From 2024-12-14 18-03-33.png
|
Before with
find
i could use theprintf
option https://unix.stackexchange.com/a/29901/196971what the best way to solve this with fd ?
The text was updated successfully, but these errors were encountered: