I have a tgz file with the following file structure
- folder
- subdir1
- file1.txt
- file2.text
- subdir2
- file1.txt
When i run tar -tf folder.tgz, it outputs the following:
folder/
folder/subdir1/
folder/subdir1/file1.txt
folder/subdir1/file2.txt
folder/subdir2/
folder/subdir2/file1.txt
How can i exclude directory names so that the outputted list is:
folder/subdir1/file1.txt
folder/subdir1/file2.txt
folder/subdir2/file1.txt
tar -tf folder.tgz | grep -v /$– Bib Nov 07 '21 at 17:30-rw-r--r-- b/users 0 2021-11-07 19:00 rr/hh\nll, and that is how they are displayed. Thank you for asking... – Bib Nov 07 '21 at 19:03tarseems to do this (nice!) but that isn't the case for othertarflavors (I just tested with busybox tar for example) and an answer could explain this and show the limitations. – terdon Nov 07 '21 at 19:05perl -MArchive::Tar -le 'for(Archive::Tar->new(shift)->get_files){print $_->name=~s/\n//gr if $_->type!=5}' archive.tgz– Nov 08 '21 at 14:55