I have a file containing pathnames from two directories. I want to sort them by filename disregarding parent directories.
Text is as so:
/mnt/samsung/a/b/c
/mnt/samsung/d/e/f
...
/mnt/wd/a/b/c
/mnt/wd/d/e/f
I want to sort as
/mnt/samsung/a/b/c
/mnt/wd/a/b/c
/mnt/samsung/d/e/f
/mnt/wd/d/e/f
I'm trying with this :
sort -t / -k3
And it's not working.
I've tried also :
sort -t "/" -k3
sort -t "/" -k2
sort -t / -k2
None of them working.
What will give what I want?
/
means thata
is the 4th field, not the 3rd – steeldriver Nov 22 '19 at 20:14