How can I search the filesystem only for the first positive match in a path? For example, searching for foo:
./some/foo/long/foo/path
./another/foo/long/foo/path
should return:
./some/foo/
./another/foo/
I think the find command should be able to do this, but I can't figure out which flags to use, obviously any other command that achieves the result would be fine.