[Melbourne-pm] Unix / Perl
Mirko Fluher
mir at pax.apana.org.au
Sun Dec 16 03:40:21 PST 2007
Could someone help with this mixture of Unix and Perl.
foreach $_ (`tree -isuDRf /dir1/fileserver/dir2/documents`)
{
next if(/^\/dir1/);
($line1, $line2) = /(.*?)\/dir1\/fileserver\/dir2\/documents(\/.*$)/;
$line1 =~ tr/[]//d;
$_ = $line1;
($userid, $size, $month, $day, $year) = /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/;
print "$userid,$size,$month,$day,$year,$line2\n";
}
# to run this prog.
# ./make_index_docu_csv.pl|sort +1 -rnt, > /dir1/fileserver/dir2/documents/documents_index.csv
I would like to have the whole thing in perl ... the problem I have at the moment is that 'tree'
truncates userid .. :(
I have some perl handing directories and files but and bits. Having problem getting userid, size time
together; not to mention the sorting.
Sorry if this is poor perl... I am not a professional.
thanks if you can point to a good direction.
--
Mirko Fluher http://pax.apana.org.au
Computers are useless. They can only give you answers. - Pablo Picasso
More information about the Melbourne-pm
mailing list