perl -MList::Util=reduce -nle"$p{reduce{$p{$a}=1;$a=qq[$a/$::b]}split'/'}=1}{print for sort keys%p" junk.dat /admin /admin/test /core /core/system /core/system/init.conf /demo /demo/test /demo/test/core /demo/test/core/newfile.cgi /demo/test/file1234.cgi