Namazu-users-en(old)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .namazurc



Mark> need something to allow the the unix directory seperator / to be
Mark> translated into a windows seperator \ and %20 replaced to a single space,
Mark> for an undefined path size and any number of %20's.

How about
--replace='s|/export/samba_docs|//server|;s|/|\\|g;s|%(\d{2})|pack("H2",$1)|ge;s|  | |g;';
? 
(Some shell escape issue may still be there, sorry)

I will attach my practice to get above line:

#!/usr/pkg/bin/perl 
my $in = '/export/samba_docs/general/august%20accounts.xls';
                 ##  \\sserver\general\august accounts.xls

$in =~ s|/export/samba_docs|//server|;
print $in,"\n";
$in =~ s|/|\\|g;
print $in,"\n";
$in =~ s|%(\d{2})|pack("H2",$1)|ge;
print $in,"\n";
$in =~ s|  | |g;

__END__

--replace='s|/export/samba_docs|//server|;s|/|\\|g;s|%(\d{2})|pack("H2",$1)|ge;s|  | |g;';

---
Makoto Fujiwara,