Is there an easy way to force sort to ignore file extensions when sorting find output by file name? I mean without extra scripting.


Not entirely sure what you mean.

But given a directory

$ ls
bar.txt  foo.abc  foo.txt

You can sort by just the name, stripping the extension, as below

$ find . -type f | sort -k 2,2 -t. -u

As ever, an example of input together with desired output would help greatly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.