namazu-users-en
[Top] [All Lists]

Re: .namazurc

To: <namazu-users-en@namazu.org>
Subject: Re: .namazurc
From: Makoto Fujiwara <makoto@ki.nu>
Date: Wed, 21 Aug 2002 17:01:52 +0900
Reply-to: namazu-users-en@namazu.org
Message-id: <yfmu1lovdvz.wl@u.ki.nu>

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, 

<Prev in Thread] Current Thread [Next in Thread>