Skip to main content
added 113 characters in body
Source Link

This is what I ended up doing: use GNU sed to duplicate the last path element at the beginning, sort the lines, then strip it back off:

... | sed -re "s/^(.*)(\/.+)$/\2\t\1\2/p" | sort | sed -re "s/^.*\t(.*)$/\1/"

If you happen to be on OSX you'll need gsed (e.g., via brew install gsed) in place of sed.

That last part could also be, if you prefer:

... | grep -Po "(?<=\t).*$"

This is what I ended up doing: use GNU sed to duplicate the last path element at the beginning, sort the lines, then strip it back off:

... | sed -re "s/^(.*)(\/.+)$/\2\t\1\2/p" | sort | sed -re "s/^.*\t(.*)$/\1/"

That last part could also be:

... | grep -Po "(?<=\t).*$"

This is what I ended up doing: use GNU sed to duplicate the last path element at the beginning, sort the lines, then strip it back off:

... | sed -re "s/^(.*)(\/.+)$/\2\t\1\2/p" | sort | sed -re "s/^.*\t(.*)$/\1/"

If you happen to be on OSX you'll need gsed (e.g., via brew install gsed) in place of sed.

That last part could also be, if you prefer:

... | grep -Po "(?<=\t).*$"
added 2 characters in body
Source Link

This is what I ended up doing: use GNU sed to duplicate the last path element at the beginning, sort the lines, then strip it back off:

... | sed -re "s/^(.*)(\/(.+)$/\2\t\1\2/p" | sort | sed -re "s/^.*\t(.*)$/\1/"

That last part could also be:

... | grep -Po "(?<=\t).*$"

This is what I ended up doing: use GNU sed to duplicate the last path element at the beginning, sort the lines, then strip it back off:

... | sed -re "s/^(.*)\/(.+)$/\2\t\1\2/p" | sort | sed -re "s/^.*\t(.*)$/\1/"

That last part could also be:

... | grep -Po "(?<=\t).*$"

This is what I ended up doing: use GNU sed to duplicate the last path element at the beginning, sort the lines, then strip it back off:

... | sed -re "s/^(.*)(\/.+)$/\2\t\1\2/p" | sort | sed -re "s/^.*\t(.*)$/\1/"

That last part could also be:

... | grep -Po "(?<=\t).*$"
Source Link

This is what I ended up doing: use GNU sed to duplicate the last path element at the beginning, sort the lines, then strip it back off:

... | sed -re "s/^(.*)\/(.+)$/\2\t\1\2/p" | sort | sed -re "s/^.*\t(.*)$/\1/"

That last part could also be:

... | grep -Po "(?<=\t).*$"