tar tvf scripts.tar | awk -F/ '{if (NF<4) print }' drwx------ glens/glens 0 2010-03-17 10:44 scripts/ -rwxr--r-- glens/www-data 1051 2009-07-27 10:42 scripts/my2cnf.pl -rwxr--r-- glens/www-data 359 2009-08-14 00:01 scripts/pastebin.sh -rwxr--r-- glens/www-data 566 2009-07-27 10:42 scripts/critic.pl -rwxr-xr-x glens/glens 981 2009-12-16 09:39 scripts/wiki_sys.pl -rwxr-xr-x glens/glens 3072 2009-07-28 10:25 scripts/blacklist_update.pl -rwxr--r-- glens/www-data 18418 2009-07-27 10:42 scripts/sysinfo.pl
确保注意,数字是3,但是你想要多个级别,因为/在用户名/组。如果你只是做
tar tf scripts.tar | awk -F/ '{if (NF<3) print }' scripts/ scripts/my2cnf.pl scripts/pastebin.sh scripts/critic.pl scripts/wiki_sys.pl scripts/blacklist_update.pl scripts/sysinfo.pl
它只有两个。