Unix/Linux: How to get the top-level directory (only) from a file path
Briefly

for file in `cat file_list` do dir_name=$(dirname "$file") echo "$dir_name" done | cut -d'/' -f 2 | sort -u
Note that if your filenames start with a leading / character, you'll probably need to change that 2 to a 1.
Read at Alvinalexander
[
add
]
[
|
|
]