Re: [PATCH] Re: deb-support-without-dpkg.patch was Re: AMC patches ported to mc-2006-02-03-13.tar.gz



Hi Pavel,

On Fri, 2006-03-10 at 10:34 +0200, Pavel Tsekov wrote:
> As far as I understand .\? will match a single char (any char) or no char
> at all so if we have (output of "ar tv"):

You are right.

What I was trying to achieve is to explicitly match the first part of
the string without being greedy (in case the file name contains a time
string). I'm not sure how to achieve that. But since the first part of
the string is unaffected by the matching anyway the first match can just
be dropped.

See attached patch for how I propose to avoid a double match in the two
expressions if the filename contains a time or date value by temporarily
introducing a unique separator string.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research

--- uar.000	2006-03-08 01:01:38.000000000 +0100
+++ uar	2006-03-11 22:11:17.000000000 +0100
@@ -12,7 +12,13 @@ XAR=ar
 
 mcarfs_list ()
 {
-	$XAR tv "$1" | sed 's,^,-,;s, , 1 ,;s,/, ,'
+    # If $temp_replace string is part of the filename that part might get lost
+    temp_replace='Unique Separator String'
+    thisyear="`date +%Y`"
+    $XAR tv "$1" | sed 's,^,-,;s, , 1 ,;s,/, ,' |
+	sed -e "s/\( [0-2][0-9]\:[0-5][0-9]\)\( $thisyear \)\(.*\)/\1$temp_replace\3/" |
+	sed -e "s/\( [0-2][0-9]\:[0-5][0-9] \)\([12][0-9][0-9][0-9] \)\(.*\)/ \2\3/" |
+	sed -e "s/$temp_replace/ /"
 }
 
 mcarfs_copyout ()


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