Rob Coops wrote:
snip
open (IN, +dummy.txt);
@file = IN;
close IN;
for ( my $i = 0; $i scalar @file; $i++ ) { # loop trought the file line by
line
if ( $file =~ m/$ARGV0/g ) { # look for argument $ARGV0
$file =~ s/$ARGV0(\b.*)/$ARGV1$1/g; # replace argument $ARGV0 with $ARGV1
$file =~
Hi, I'm stuck with what will probably turn out to be a simple solution,
I've been scouring google for ages, and can't find anything close to
what I'm looking for.
Given that
$fred = 10
$barney = abcdefghijklmn
how do I get $wilma = j
Thanks
Brian
--
To unsubscribe, e-mail: [EMAIL
Rob Dixon wrote:
brian54321uk wrote:
Hi, I'm stuck with what will probably turn out to be a simple solution,
I've been scouring google for ages, and can't find anything close to
what I'm looking for.
Given that
$fred = 10
$barney = abcdefghijklmn
how do I get $wilma = j
my $wilma
John W. Krahn wrote:
brian54321uk wrote:
Hi,
Hello,
I'm stuck with what will probably turn out to be a simple solution,
I've been scouring google for ages, and can't find anything close to
what I'm looking for.
Given that
$fred = 10
$barney = abcdefghijklmn
how do I get $wilma = j
Rob Dixon wrote:
brian54321uk wrote:
Hi, I'm stuck with what will probably turn out to be a simple solution,
I've been scouring google for ages, and can't find anything close to
what I'm looking for.
Given that
$fred = 10
$barney = abcdefghijklmn
how do I get $wilma = j
my $wilma
brian54321uk wrote:
Rob Dixon wrote:
brian54321uk wrote:
Hi, I'm stuck with what will probably turn out to be a simple
solution, I've been scouring google for ages, and can't find anything
close to what I'm looking for.
Given that
$fred = 10
$barney = abcdefghijklmn
how do I get $wilma
brian54321uk wrote:
Rob Dixon wrote:
brian54321uk wrote:
Hi, I'm stuck with what will probably turn out to be a simple
solution, I've been scouring google for ages, and can't find anything
close to what I'm looking for.
Given that
$fred = 10
$barney = abcdefghijklmn
how do I get $wilma
brian54321uk wrote:
brian54321uk wrote:
Rob Dixon wrote:
brian54321uk wrote:
Hi, I'm stuck with what will probably turn out to be a simple
solution, I've been scouring google for ages, and can't find
anything close to what I'm looking for.
Given that
$fred = 10
$barney = abcdefghijklmn
John W. Krahn wrote:
Aruna Goke wrote:
brian54321uk wrote:
Aruna Goke wrote:
Mr. Shawn H. Corey wrote:
On Fri, 2008-09-05 at 19:09 +0100, brian54321uk wrote:
HI again
I would like to test a folder full of files, and if a file
contains abc123blue or xyz357green then that file
John W. Krahn wrote:
Dr.Ruud wrote:
brian54321uk schreef:
I would like to test a folder full of files, and if a file contains
abc123blue or xyz357green then that file is to be deleted.
What would be the best way of achieving this please?
I would use `grep -l` to get the list of filenames
Aruna Goke wrote:
brian54321uk wrote:
Aruna Goke wrote:
Mr. Shawn H. Corey wrote:
On Fri, 2008-09-05 at 19:09 +0100, brian54321uk wrote:
HI again
I would like to test a folder full of files, and if a file contains
abc123blue or xyz357green then that file is to be deleted.
What would
Peter Scott wrote:
On Fri, 05 Sep 2008 19:09:25 +0100, brian54321uk wrote:
I would like to test a folder full of files, and if a file contains
abc123blue or xyz357green then that file is to be deleted.
What would be the best way of achieving this please?
One way:
use strict;
use warnings
[EMAIL PROTECTED] wrote:
Here's another way, but not necessarily the best Perl, but it does work:
#!/usr/bin/env perl
use strict;
use warnings;
my @filelist=STDIN;
chomp @filelist;
my $match_strings=qr '(abc123blue|xyz357green)';
my ($file, );
foreach $file (@filelist) {
#print file=$file\n;
HI again
I would like to test a folder full of files, and if a file contains
abc123blue or xyz357green then that file is to be deleted.
What would be the best way of achieving this please?
If however, it would be simpler for the script to empty the files
contents, that's not a problem as I
Hi
I would like to replace a string of characters in a file to the name of
the directory it is in.
Thefore, in the example below, I would like to know how to replace ?
open( F, $ARGV[0] );
while( F ) {
s!abc123!?!;
s!xyz123!123xyz!;
{
print;
}
}
Any help much appreciated.
Brian
Mr. Shawn H. Corey wrote:
On Wed, 2008-09-03 at 14:55 +0100, brian54321uk wrote:
Hi
I would like to replace a string of characters in a file to the name of
the directory it is in.
Thefore, in the example below, I would like to know how to replace ?
open( F, $ARGV[0] );
while( F ) {
s
, brian54321uk wrote:
Just tested this out and unfortunately instead of dirname replacing
abc123, I get a .
That's because the dirname is a '.'
Try:
use Cwd;
if( (my $dir = dirname( $file )) eq '.' ){
$dir = cwd();
}
--
Just my 0.0002 million dollars worth
17 matches
Mail list logo