Monday, November 04, 2019

[howTo] List directories that contain a file, according to a pattern

BASH text manipulation can do it, but this is more elegant if you're already using find in linux...

find (pattern here) -printf '%h\n' | sort | uniq

Example:
find . -type -f -name '*txt' -printf '%h\n' | sort | uniq