[Melbourne-pm] Unix / Perl

David Dick ddick at aapt.net.au
Sun Dec 16 12:56:00 PST 2007


Mirko Fluher wrote:
> 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.
>
>   
This attempt uses some of the modules you might need mirko. Best of luck.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tmp.pl
Url: http://mail.pm.org/pipermail/melbourne-pm/attachments/20071217/186c8fc1/attachment.pl 


More information about the Melbourne-pm mailing list