On Mon, Jun 28, 2010 at 19:48, John W. Krahn wrote:
snip
> s/\((\d+)\)/($1)/g;
snip
Since Perl 5.8.0, \d does not mean [0-9], it means any character that
is classified as a digit in Unicode. In Perl 5.12.1, there are five
hundred seventy-seven characters that will match \d. If it is your
intent
On 2010.06.28 20:39, jimston...@aol.com wrote:
>
> In a message dated 6/28/2010 7:49:47 P.M. Eastern Daylight Time,
> jwkr...@shaw.ca writes:
>
> jimston...@aol.com wrote:
>>
>> can anyone give me some help on a perl program to change a file of mine.
>> The string is:
>>
>> $_ = "from ''ala
In a message dated 6/28/2010 7:49:47 P.M. Eastern Daylight Time,
jwkr...@shaw.ca writes:
jimston...@aol.com wrote:
>
> can anyone give me some help on a perl program to change a file of mine.
> The string is:
>
> $_ = "from ''alam' (481) or possibly (in the sense of dumbness);
> solitary;
jimston...@aol.com wrote:
can anyone give me some help on a perl program to change a file of mine.
The string is:
$_ = "from ''alam' (481) or possibly (in the sense of dumbness);
solitary; Ulam, the (6155) name of two Soldiers;--Ulam."
Where each line is $_
I'm trying to substitute a hyperli
jimston...@aol.com wrote:
can anyone give me some help on a perl program to change a file of mine.
The string is:
$_ = "from ''alam' (481) or possibly (in the sense of dumbness);
solitary; Ulam, the (6155) name of two Soldiers;--Ulam."
Where each line is $_
I'm trying to substitute a hyperli
can anyone give me some help on a perl program to change a file of mine.
The string is:
$_ = "from ''alam' (481) or possibly (in the sense of dumbness);
solitary; Ulam, the (6155) name of two Soldiers;--Ulam."
Where each line is $_
I'm trying to substitute a hyperlink for each NUMBER tha
John W. Krahn wrote:
> Moon, John wrote:
>>Does any one know how to do this with just a substitution?
>>
>>perl -e '$a=q{Data.m1234.D1234567890};
>> $a =~/\d+$/;
>> $numbers = q{#} x length($&);
>> $a=~ s/\d+$/$numbers/; print "$a\n";'
>>
>>What " Data.m1234.D## " as a result
Moon, John wrote:
> Does any one know how to do this with just a substitution?
>
> perl -e '$a=q{Data.m1234.D1234567890};
> $a =~/\d+$/;
> $numbers = q{#} x length($&);
> $a=~ s/\d+$/$numbers/; print "$a\n";'
>
> What " Data.m1234.D## " as a result.
$ perl -le'$_ = q{Da
Moon, John wrote:
> Does any one know how to do this with just a substitution?
>
> perl -e '$a=q{Data.m1234.D1234567890};
> $a =~/\d+$/;
> $numbers = q{#} x length($&);
> $a=~ s/\d+$/$numbers/; print "$a\n";'
>
> What " Data.m1234.D## " as a result.
>
> John W Moon
Did
Does any one know how to do this with just a substitution?
perl -e '$a=q{Data.m1234.D1234567890};
$a =~/\d+$/;
$numbers = q{#} x length($&);
$a=~ s/\d+$/$numbers/; print "$a\n";'
What " Data.m1234.D## " as a result.
John W Moon
--
To unsubscribe, e-mail: [EMAIL
Steve Massey wrote:
>
> Hi
Hello,
> I though I had sussed this s/ stuff but
>
> #! /usr/bin/perl -w
>
> $test = "BRIGHTON (Firm)";
>
> print "$test\n";
> $test =~ s/,*/,/;
> $test =~ s/,*$/,/g;
>
> print "$test\n";
>
> does not work, I want to su
Steve Massey wrote:
> Hi
>
> I though I had sussed this s/ stuff but
>
> #! /usr/bin/perl -w
>
> $test = "BRIGHTON (Firm)";
>
> print "$test\n";
> $test =~ s/,*/,/;
> $test =~ s/,*$/,/g;
>
> print "$test\n";
>
> does not work, I want to substitute all m
> From: Steve Massey [mailto:[EMAIL PROTECTED]
> Sent: 23 October 2003 11:33
>
> #! /usr/bin/perl -w
>
> $test = "BRIGHTON (Firm)";
>
>
> print "$test\n";
> $test =~ s/,*/,/;
> $test =~ s/,*$/,/g;
>
> print "$test\n";
It looks like the +/* issue has bee
> Ok scrub that
>
> + works but * doesn't
>
> i'm guess the * is matching anything
>
> took me 2 hours to figure that ;)
>
To de-mystify the regexes some have a look at:
perldoc perlretut
perldoc perlre
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional comma
ally want to do
s/,,+/,/;
which will not then replace 1 comma with another.
Gary
>
>
>
>
>
> -Original Message-
> From: Steve Massey [mailto:[EMAIL PROTECTED]
> Sent: 23 October 2003 11:33
> To: [EMAIL PROTECTED]
> Subject: substitution problem
>
>
&g
Ok scrub that
+ works but * doesn't
i'm guess the * is matching anything
took me 2 hours to figure that ;)
-Original Message-
From: Steve Massey [mailto:[EMAIL PROTECTED]
Sent: 23 October 2003 11:33
To: [EMAIL PROTECTED]
Subject: substitution problem
Hi
I though I
Hi
I though I had sussed this s/ stuff but
#! /usr/bin/perl -w
$test = "BRIGHTON (Firm)";
print "$test\n";
$test =~ s/,*/,/;
$test =~ s/,*$/,/g;
print "$test\n";
does not work, I want to substitute all multiple commas into a single one.
any hel
Birgit Kellner wrote:
>
> use POSIX 'setlocale';
> use locale;
> use strict;
> use warnings;
> setlocale( &POSIX::LC_ALL, "de" );
> my %rec;
> $rec{'content'} = qq| value="77">"Madhyamaka." In: "Buddhismus in Geschichte und
> Gegenwart, Bd. I." Hamburg: Universität Hamburg (Weiterbildendes Studiu
On Jan 15, birgit kellner said:
>$rec{'content'} = qq|value="77">"Madhyamaka." In: "Buddhismus in Geschichte und
>Gegenwart, Bd. I." Hamburg: Universität Hamburg (Weiterbildendes Studium)
>1998, 180-189.value="77">"Zum Konzept der Leerheit im BCA." In: "Buddhismus
>in Geschichte und Gegenwart,
use POSIX 'setlocale';
use locale;
use strict;
use warnings;
setlocale( &POSIX::LC_ALL, "de" );
my %rec;
$rec{'content'} = qq|"Madhyamaka." In: "Buddhismus in Geschichte und
Gegenwart, Bd. I." Hamburg: Universität Hamburg (Weiterbildendes Studium)
1998, 180-189."Zum Konzept der Leerheit im BCA."
> -Original Message-
> From: Mark Martin [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 08, 2001 10:01
> To: [EMAIL PROTECTED]
> Subject: Substitution Problem
>
>
> Hi,
> I'm taking in a csv file and splitting it. One of the fields(doc) could
> possibly
Mart Marken said:
> I'm taking in a csv file and splitting it. One of the fields(doc) could
> possibly have six spaces which will disrupt the program later on so I need
> to substitute in dummy values. $doc == " " finds the "empty" fields
> okay but the substitution doesn't work. Clear as Mud
Good day;
At 05:01 PM 6/8/2001 +, Mark Martin wrote:
>
> if ($doc == " "){
>
> doc =~ s/ /11/;
should be:
$doc =~ s/ /11/; #don't forget the "$"
Also, try
$doc =~ tr/ /11/;
Being a newbie myself, I stumb
tever.
Wags ;)
-Original Message-
From: Mark Martin [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 08, 2001 10:01
To: [EMAIL PROTECTED]
Subject: Substitution Problem
Hi,
I'm taking in a csv file and splitting it. One of the fields(doc) could
possibly have six spaces which will d
Hi,
I'm taking in a csv file and splitting it. One of the fields(doc) could
possibly have six spaces which will disrupt the program later on so I need
to substitute in dummy values. $doc == " " finds the "empty" fields
okay but the substitution doesn't work. Clear as Mud?? Any ideas?
open (F
On May 29, Me said:
>If you will allow perl to make use of temporary files
>behind the scenes (which is normally perfectly ok),
>Cookbook recipe 7.9 is a whole heck of a lot
>simpler. As a command line one liner:
>
>perl -pie 's/a/p/g' try.txt foo.txt
>
>will go thru files try.txt and foo.txt
Cookbook recipe 7.10, as quoted by JJ, has the
virtue that it does not use a temporary file.
If you will allow perl to make use of temporary files
behind the scenes (which is normally perfectly ok),
Cookbook recipe 7.9 is a whole heck of a lot
simpler. As a command line one liner:
perl -pie
Thanks! The method you suggested works, though it is not SIMPLE AND
SWEET!! :-) Thanks, anyways.
Prachi
Original Message Follows
From: "J. J. Horner" <[EMAIL PROTECTED]>
To: prachi shroff <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: substitution pro
On Tue, 29 May 2001, prachi shroff wrote:
> I am having problems using the "s///" operator for substitution in of a
> particular pattern in a specified file.
> For eg.
>
> open(TRY,"+ while()
> {
> $_ =~ s/a/p/g;
> }
This does nothing to your file. You need to write your data back out to
> I am having problems using the "s///" operator for substitution in of
a
> particular pattern in a specified file.
> For eg.
>
> open(TRY,"+ while()
> {
> $_ =~ s/a/p/g;
> }
>
> Is this the right way of doing it? And with what access mode shall I
open
> the file ( >> or +> or +< ) ? And is
Is there any reason you chose not to do it this way:
# From Perl Cookbook:
open(TRY,"+< try.txt") or die "Couldn't open try.txt: $!\n";
my @lines =# Slurp all lines into an
array.
foreach my $line (@lines) { # Iterate
Hi again!
I am having problems using the "s///" operator for substitution in of a
particular pattern in a specified file.
For eg.
open(TRY,"+)
{
$_ =~ s/a/p/g;
}
Is this the right way of doing it? And with what access mode shall I open
the file ( >> or +> or +< ) ? And is the while loop
32 matches
Mail list logo