- Original Message -
From: Moon, John [EMAIL PROTECTED]
To: 'Tham, Philip' [EMAIL PROTECTED]
Cc: beginners@perl.org
Sent: Tuesday, May 10, 2005 4:55 PM
Subject: RE: Help with substitution
To: 'Tham, Philip'
Subject: RE: Help with substitution
Subject: Help with substitution
Hi
I have
To: 'Tham, Philip'
Subject: RE: Help with substitution
Subject: Help with substitution
Hi
I have a string which reoccuring patterns
1abc2abc3abc4abc567
How do I remove everything before the 1st occrence of abc to get the
result
2abc3abc4abc567
s/^.*abc//
Gives me
567
Thanks in advance
This worked for me. Don't forget the 'greedy' regex:
s/^.*?(abc)//;
-Original Message-
From: Tham, Philip [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 10, 2005 3:59 PM
To: beginners@perl.org
Subject: Help with substitution
Hi
I have a string which reoccuring patterns
Jeff Westman wrote:
I'm trying to help out another developer with a mini-Perl script.
He has a file that contains one very long line, about 28M in size.
He needs to do a replacement of all occurances of
|^NEWLINE^|^
to a literal newline (HPUX, 0x0a or \n).
When I ran this
$
On Thu, Feb 19, 2004 at 04:36:55PM -0800, david wrote:
Jeff Westman wrote:
I'm trying to help out another developer with a mini-Perl script.
He has a file that contains one very long line, about 28M in size.
He needs to do a replacement of all occurances of
|^NEWLINE^|^
to a
Paul Johnson wrote:
[panda]# perl -ne 'BEGIN{$/=\10} s/\|\^NEWLINE\^\|\^/\n/g; print'
[loadFile
The trouble with this approach is that you will miss any separators
which are split. Your example actually reads 10 bytes at a time, but
using $/ is the right idea:
perl -ple 'BEGIN {
Paul Johnson [EMAIL PROTECTED] wrote:
On Thu, Feb 19, 2004 at 04:36:55PM -0800, david wrote:
Jeff Westman wrote:
I'm trying to help out another developer with a mini-Perl
script.
He has a file that contains one very long line, about 28M in
size.
He needs to do a replacement of
Jeff Westman wrote:
When I ran this
$ perl -ne 's/|^NEWLINE^|^/\n/g;print' loadFile
The program loads the ENTIRE loadfile and then splits characters at
whitespace between characters and then prints every character followed
by a newline.
So, how big is loadfile?
WC -Sx- Jones [EMAIL PROTECTED]
wrote:
Jeff Westman wrote:
When I ran this
$ perl -ne 's/|^NEWLINE^|^/\n/g;print' loadFile
The program loads the ENTIRE loadfile and then splits characters
at
whitespace between characters and then prints every character
followed
by a
Hello Erik
It's not clear exactly what you want, but something like this should do the
job:
for (my $i = 0; $i length $word; ++$i)
{
substr ($word, $i, 1) = '-' unless substr ($givenword, $i, 1) eq
'X';
}
HTH,
Rob
- Original Message -
From: Erik Browaldh [EMAIL
Hi!
no, its still not changing the letters (but thanks Rob)..
I have a string:
$givenword=YY-
and another string (the original)
$word=not
now I want $givenword to look like this:
$givenword=no-
?
thanks in advanced!
Erik
Rob Dixon wrote:
Hello Erik
It's not clear exactly what you want,
Hi Erik
You might like this!
$givenword =~ s/[a-z]/substr $word, pos $givenword, 1/egi;
Cheers,
R
- Original Message -
From: Erik Browaldh [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 11, 2002 4:01 PM
Subject: Re: help with substitution
Hi!
no, its
12 matches
Mail list logo