List the directories on depthlevel one in tar.gz
find, grep, linux
Solution
You can use the `--exclude` option to exclude everything that's within a directory.
tar tfz archive.tar.gz --exclude '*/*'
Example:
[me@home]$ tar tfj CUnit-2.1-2-src.tar.bz2 | head -n5
CUnit-2.1-2/
CUnit-2.1-2/NEWS
CUnit-2.1-2/Makefile.am
CUnit-2.1-2/configure
CUnit-2.1-2/cunit.pc.in
[me@home]$ tar tfj CUnit-2.1-2-src.tar.bz2 --exclude '*/*'
CUnit-2.1-2/
Problem
How can the directories on the level one can be listed in a tar.gz archive? E.g. \dir1\ \dir2\ \dir3\ \dir4\ \dir1\ Not \dir1\bla \dir1\bla2