Re: Remove duplicate files

2010-07-13 Thread David Christensen
Harinatha Reddy M wrote: I want to remove any duplicate files(same in content with different file names) in a particular directory. How can we do that? $ cpan Bundle::Dpchrist $ man finddups And what if the file is being accessed by some process. Can we delete it? Dpchrist

Re: \1 in character class?

2010-07-13 Thread Chas. Owens
On Jul 13, 2010, at 11:32, Erez Schatz wrote: > On 13 July 2010 18:16, Shawn H Corey wrote: > >> Because [] define a character set; everything inside it is a character. >> That means it does not expand \1. > > That's not entirely correct. Character classes recognize variables, > escaped ch

Re: \1 in character class?

2010-07-13 Thread Erez Schatz
On 13 July 2010 18:16, Shawn H Corey wrote: > Because [] define a character set;  everything inside it is a character. >  That means it does not expand \1. That's not entirely correct. Character classes recognize variables, escaped characters and some other regexp notation, but not \1 back-refer

Re: \1 in character class?

2010-07-13 Thread Chas. Owens
On Tue, Jul 13, 2010 at 06:00, Bryan R Harris wrote: > > > I'm trying to temporarily deal with simple quoted strings by turning: > >  data: "this is a string" more: "this is another" > > into... > >  data: "this is a string" more: "this is another" > > I thought this would work: > >  s/(['"])([^\1

Re: \1 in character class?

2010-07-13 Thread Erez Schatz
On 13 July 2010 13:00, Bryan R Harris wrote: > > I thought this would work: > >  s/(['"])([^\1]*)\1/${1}.despace($2).$1/gse; > > ... but it doesn't.  It looks like the [^\1]* in the regexp isn't working > right. Character classes (characters inside square brackets - []) in regexp notation, inter

Re: \1 in character class?

2010-07-13 Thread Shawn H Corey
On 10-07-13 06:00 AM, Bryan R Harris wrote: I'm trying to temporarily deal with simple quoted strings by turning: data: "this is a string" more: "this is another" into... data: "this is a string" more: "this is another" I thought this would work: s/(['"])([^\1]*)\1/${1}.despace($2

Re: \1 in character class?

2010-07-13 Thread Jennifer Jones Harrington
How about... #!/usr/bin/perl use warnings; $_ = "data: \"this is a string\" more: \"this is another\""; s/(\w+)\s/$1 /g; print "$_\n"; It prints: data: "this is a string" more: "this is another" On Tue, Jul 13, 2010 at 6:00 AM, Bryan R Harris wrote: > > > I'm trying to temporarily deal with

\1 in character class?

2010-07-13 Thread Bryan R Harris
I'm trying to temporarily deal with simple quoted strings by turning: data: "this is a string" more: "this is another" into... data: "this is a string" more: "this is another" I thought this would work: s/(['"])([^\1]*)\1/${1}.despace($2).$1/gse; sub despace { my $t = shift;

RE: Remove duplicate files

2010-07-13 Thread Bob McConnell
From: Shawn H Corey > On 10-07-13 01:58 AM, John W. Krahn wrote: >> Harinatha Reddy M wrote: >>> And what if the file is being accessed by some process. Can we delete it? >> >> Probably not on Windows, probably yes on Unix/Linux. > > On Linux, the contents of the file will be kept until all proce

Re: Remove duplicate files

2010-07-13 Thread Shawn H Corey
On 10-07-13 01:58 AM, John W. Krahn wrote: Harinatha Reddy M wrote: And what if the file is being accessed by some process. Can we delete it? Probably not on Windows, probably yes on Unix/Linux. On Linux, the contents of the file will be kept until all processes that have it open, closes it

Re: Please explain the one string

2010-07-13 Thread Chas. Owens
On Mon, Jul 12, 2010 at 15:21, redtigra wrote: > Rob, > > GREAT thanks, your explanantion is very detailed and very clear. Looks > like I don't have a clear understanding regarding -n option, so I have > something for reading for the evening :) snip When trying to understand what Perl is doing be

Re: Please explain the one string

2010-07-13 Thread redtigra
Rob, GREAT thanks, your explanantion is very detailed and very clear. Looks like I don't have a clear understanding regarding -n option, so I have something for reading for the evening :) > If you > want to have a decent solution that others can understand and read put this > in a small script wh