> On Jun 29, 2016, at 09:20, Uri Guttman wrote:
>
> since you are correct about modules being already there, why do you write
> your own versions of
> slurp_file and write_file? the module File::Slurp has those functions which
> are stable, fast and debugged.
Please don’t use File::Slurp. Se
Op 29-06-16 om 19:26 schreef Uri Guttman:
On 06/29/2016 01:17 PM, Eric de Hont wrote:
Op 29-06-16 om 18:20 schreef Uri Guttman:
since you are correct about modules being already there, why do you
write your own versions of
slurp_file and write_file? the module File::Slurp has those
functions w
On 06/29/2016 01:17 PM, Eric de Hont wrote:
Op 29-06-16 om 18:20 schreef Uri Guttman:
On 06/29/2016 06:03 AM, Eric de Hont wrote:
sub slurp_file {
my $file = shift;
local $/;
open my $fh, '<', $file or die "Can't open $_: $!\n";
$_ is not set anywhere. you likely meant to use $f
Op 29-06-16 om 18:20 schreef Uri Guttman:
On 06/29/2016 06:03 AM, Eric de Hont wrote:
sub slurp_file {
my $file = shift;
local $/;
open my $fh, '<', $file or die "Can't open $_: $!\n";
$_ is not set anywhere. you likely meant to use $file
O, dear. Just a bit too quick and dirty.
On 06/29/2016 06:03 AM, Eric de Hont wrote:
Op 29-06-16 om 06:35 schreef Danny Wong:
Hi Perl GURUs,
I have a json file that needs parsing.
Here is a typical string I’m searching for. I want to delete
everything but the last 2 character “],”.
],
[
"ansible",
ers@perl.org>>
Subject: Re: search and replace
Op 29-06-16 om 06:35 schreef Danny Wong:
Hi Perl GURUs,
I have a json file that needs parsing.
Here is a typical string I’m searching for. I want to delete everything but the
last 2 character “],”.
],
[
"a
Op 29-06-16 om 06:35 schreef Danny Wong:
Hi Perl GURUs,
I have a json file that needs parsing.
Here is a typical string I’m searching for. I want to delete
everything but the last 2 character “],”.
],
[
"ansible",
"2.1.0.0-1ppa~trusty",
false
],
Here is wh
Hi Danny,
Please reply to all recipients. See below for my reply.
On Wed, 29 Jun 2016 04:35:22 +
Danny Wong wrote:
> Hi Perl GURUs,
> I have a json file that needs parsing.
>
Why not use a JSON parser? See http://perl-begin.org/uses/text-parsing/ .
> Here is a typical string I’m searchin
Hi Perl GURUs,
I have a json file that needs parsing.
Here is a typical string I’m searching for. I want to delete everything but the
last 2 character “],”.
],
[
"ansible",
"2.1.0.0-1ppa~trusty",
false
],
Here is what I tried:
I slu
Hi Omega,
On Sat, 1 Feb 2014 11:36:20 -0500
Omega -1911 <1911...@gmail.com> wrote:
> Good advice Shlomi. Thank you again. I should have caught that with fresh
> eyes!
You're welcome! ☺
Regards,
Shlomi Fish
--
-
Shlomi Fis
On Sat, Feb 1, 2014 at 4:57 AM, Shlomi Fish wrote:
> Hi Omega,
>
> On Sat, 1 Feb 2014 03:40:01 -0500
> Omega -1911 <1911...@gmail.com> wrote:
>
> > Hello List: I am trying to go through a folder of php scripts to add a
> > database prefix to lines that have a select statement. Since the database
Hi Omega,
On Sat, 1 Feb 2014 03:40:01 -0500
Omega -1911 <1911...@gmail.com> wrote:
> Hello List: I am trying to go through a folder of php scripts to add a
> database prefix to lines that have a select statement. Since the database
> prefix will differ, I am simply trying to add:
>
> ".$database
What error?
(Sent from iPhone, so please accept my apologies in advance for any spelling or
grammatical errors.)
> On Feb 1, 2014, at 2:40 AM, Omega -1911 <1911...@gmail.com> wrote:
>
> Hello List: I am trying to go through a folder of php scripts to add a
> database prefix to lines that have
Hello List: I am trying to go through a folder of php scripts to add a
database prefix to lines that have a select statement. Since the database
prefix will differ, I am simply trying to add:
".$database_prefix."
to those lines. For example, instead of the line looking like: $sql =
"SELECT * FROM
e "Could not open '$file'\n";
> while (my $line = <$data>)
> {
>if ($csv->parse($line))
>{
>my @row = $csv->fields();
>print "$row\n";
>// compare and replace string name to id.
>}
>else
&g
"Cannot
use CSV: ".Text::CSV->error_diag ();
open(my $data, '<', $file) or die "Could not open '$file'\n";
while (my $line = <$data>)
{
if ($csv->parse($line))
{
my @row = $csv->fields();
print "$row\n";
Hi Irfan Sayed,
Please check my comments below.
On 8/18/12, Irfan Sayed wrote:
> hi,
>
> i have string like this :
> $a = '$(workspace)\convergence\trunk';
>
> i need to replace $(workspace) with 'c:\p4\abc'
> i wrote regex like this :
>
> $a
thanks a lot
regards
irfan
From: Shawn H Corey
To: beginners@perl.org
Cc: Irfan Sayed
Sent: Saturday, August 18, 2012 6:50 AM
Subject: Re: search and replace
On Fri, 17 Aug 2012 18:02:23 -0700 (PDT)
Irfan Sayed wrote:
> i have string like this :
&
On Fri, 17 Aug 2012 18:02:23 -0700 (PDT)
Irfan Sayed wrote:
> i have string like this :
> $a = '$(workspace)\convergence\trunk';
>
> i need to replace $(workspace) with 'c:\p4\abc'
> i wrote regex like this :
>
> $a =~ s/$\(workspace)/c:\\p4\\abc/;
The
hi,
i have string like this :
$a = '$(workspace)\convergence\trunk';
i need to replace $(workspace) with 'c:\p4\abc'
i wrote regex like this :
$a =~ s/$\(workspace)/c:\\p4\\abc/;
however, the string which i am getting is :
$(c:\p4\abc)\convergence\trunk
i need output l
On Thu, 16 Aug 2012 10:55:03 +0200
Gergely Buday wrote:
> Notice that in order to put a literal backslash into a perl string,
> you should escape it. In your original program, you have put a \b, a
> bell character into the string.
Actually, "\b" is the backspace character. The bell or alarm char
Awesome
thanks all for reply . got it
regards
irfan
From: midhun
To: Rob Coops
Cc: Gergely Buday ; Irfan Sayed ;
"beginners@perl.org"
Sent: Thursday, August 16, 2012 2:41 PM
Subject: Re: search and replace
The issue is
$cs_project = &qu
_text\n";
> >
> > Notice that in order to put a literal backslash into a perl string,
> > you should escape it. In your original program, you have put a \b, a
> > bell character into the string.
> >
> > - Gergely
> >
> > On 16 August 2012 10:48, I
ckslash into a perl string,
> you should escape it. In your original program, you have put a \b, a
> bell character into the string.
>
> - Gergely
>
> On 16 August 2012 10:48, Irfan Sayed wrote:
> > hi,
> >
> > i have following code to search single "
l character into the string.
- Gergely
On 16 August 2012 10:48, Irfan Sayed wrote:
> hi,
>
> i have following code to search single "\" and replace it with "\\"
> but it is not doing as expected:
>
> $csproj_text = "C:\build.txt";
>
> $csproj_tex
hi,
i have following code to search single "\" and replace it with "\\"
but it is not doing as expected:
$csproj_text = "C:\build.txt";
$csproj_text =~ s/\\//g;
print "$csproj_text\n";
the output is : "Cuild.txt"
instead the output shou
On 12-02-21 11:37 AM, Adams Paul wrote:
Sent from my LG phone
Is this is what is called a bum dial?
--
Just my 0.0002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
It's Mutual Aid, not fierce competition, that's the dom
Sent from my LG phone
"John W. Krahn" wrote:
>Chris Stinemetz wrote:
>> I am trying ot find a way to use an array as a reference to remove
>> lines from a file.
>> The array @keyFields has the elements "rcsm and cdmno". My objective
>> is to remove any line from the input that matches the regex
Thank you everyone that replied.
Your suggestions helped me with finding a solution.
Take care,
Chris
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
Chris Stinemetz wrote:
I am trying ot find a way to use an array as a reference to remove
lines from a file.
The array @keyFields has the elements "rcsm and cdmno". My objective
is to remove any line from the input that matches the regex /rcsm\d/
and cdmno\d/.
AND means matching BOTH in the sam
> -Original Message-
> From: Chris Stinemetz [mailto:chrisstinem...@gmail.com]
> Sent: Monday, February 20, 2012 3:51 PM
> To: beginners@perl.org
> Subject: Re: search and replace with an array
>
> Looks like I was able to figure it out with the below:
>
>
>-Original Message-
>From: Chris Stinemetz [mailto:chrisstinem...@gmail.com]
>Sent: Monday, February 20, 2012 13:51
>To: beginners@perl.org
>Subject: Re: search and replace with an array
>
>Looks like I was able to figure it out with the below:
>
>But how do I
Looks like I was able to figure it out with the below:
But how do I remove all the blank lines?
Output:
cdmno=1
rdnt_cdmno=1
cdmno=2
rcsm=801
rcsm=801
rcsm=802
#!/usr/bin/perl
use warnings;
use strict;
my $file = "nonKeys.txt";
my $newFile = "cleanKeys.txt";
my @keyFields
I am trying ot find a way to use an array as a reference to remove
lines from a file.
The array @keyFields has the elements "rcsm and cdmno". My objective
is to remove any line from the input that matches the regex /rcsm\d/
and cdmno\d/.
I'm not sure if I'm using the best approach.
I am getting t
On Thu, Dec 15, 2011 at 07:36:37AM -0800, Melvin wrote:
> Hi,
Hello:
> I was trying to write a script to replace baby to bigboy in a file:-
> However the below script doesn't work Could someone help me???
>
> #!/usr/bin/perl -w
> use strict;
>
> open (FILE_IN , $A
On 12/16/2011 03:23 PM, Chris Stinemetz wrote:
Hello Melvin,
Give this a try. I used the advice Jim gave and this is what I came up
with. It seems to do what you are asking for.
#!/usr/bin/perl
use warnings;
use strict;
my $inFile = "input.txt";
my $outFile = "output.txt";
open my $fin, '<',
Hello Melvin,
Give this a try. I used the advice Jim gave and this is what I came up
with. It seems to do what you are asking for.
#!/usr/bin/perl
use warnings;
use strict;
my $inFile = "input.txt";
my $outFile = "output.txt";
open my $fin, '<', $inFile or die "ERROR opening $inFile: $!";
open
Metakey/LIA
484-213-1315
From: Melvin [whereismel...@gmail.com]
Sent: Thursday, December 15, 2011 10:36 AM
To: beginners@perl.org
Subject: Replace words in a file using perl script
Hi,
I am a Perl baby :-)
I was trying to write a script to replace baby to bigboy in a file:-
On 12/15/11 Thu Dec 15, 2011 7:36 AM, "Melvin"
scribbled:
> Hi,
>
> I am a Perl baby :-)
>
> I was trying to write a script to replace baby to bigboy in a file:-
> However the below script doesn't work Could someone help me???
The problem with your script is
Hi,
I am a Perl baby :-)
I was trying to write a script to replace baby to bigboy in a file:-
However the below script doesn't work Could someone help me???
#!/usr/bin/perl -w
use strict;
open (FILE_IN , $ARGV[0]) || die ("ERROR: Gimme Input pleease");
my @array_of_lines = ;
f
C.DeRykus wrote:
If you're permitted a one-liner:
perl -pi.bak -e '$c=s/Dood\/Dude/ if !$c++' file
$ perl -c -pi.bak -e '$c=s/Dood\/Dude/ if !$c++'
Substitution replacement not terminated at -e line 1.
John
--
Any intelligent fool can make things bigger and
more complex... It takes a t
On Aug 21, 4:33 am, xecro...@yahoo.com (Ron Weidner) wrote:
> Recently, I was asked to find the first occurrence of a word in a text file
> and replace it with an alternate word. This was my solution. As a new Perl
> programmer, I feel like this solution was too C like and not en
>>>>> "John" == "John W Krahn" writes:
John> ?Dood? && s/Dood/Dude/;
Deprecated in 5.14. Replace with m?Dood? and you're good though.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
http://www.sto
> "JWK" == John W Krahn writes:
JWK> There are a few ways to do what you require:
and you missed the simplest one so far (i did mention edit_file):
JWK> #!/usr/bin/perl
JWK> use strict;
JWK> use warnings;
use File::Slurp qw( edit_file ) ;
my $file = 'data.txt' ;
> "JWK" == John W Krahn writes:
JWK> There are a few ways to do what you require:
and you missed the simplest one so far (i did mention edit_file):
JWK> #!/usr/bin/perl
JWK> use strict;
JWK> use warnings;
use File::Slurp qw( edit_file ) ;
edit_file { s/Dood/Dude/g } $file
Ron Weidner wrote:
Recently, I was asked to find the first occurrence of a word in a text
file and replace it with an alternate word. This was my solution. As
a new Perl programmer, I feel like this solution was too C like and
not enough Perl like. So, my question is what would have been the
>>>>> "SHC" == Shawn H Corey writes:
SHC> On 11-08-21 07:33 AM, Ron Weidner wrote:
>> Recently, I was asked to find the first occurrence of a word in a text
file and replace it with an alternate word. This was my solution. As a new
Perl programmer, I
On 21/08/2011 13:21, Rob Dixon wrote:
Hey Ronald
Here is a program like yours, that reads the entire file into memory and
then outputs the altered version.
#!/usr/bin/perl
use strict;
use warnings;
#program finds the first occurrence of the word Dood and
#replaces it with the word Dude in the
On 21/08/2011 12:33, Ron Weidner wrote:
>
> Recently, I was asked to find the first occurrence of a word in a
> text file and replace it with an alternate word. This was my
> solution. As a new Perl programmer, I feel like this solution was too
> C like and not enough Perl like.
On 11-08-21 07:33 AM, Ron Weidner wrote:
Recently, I was asked to find the first occurrence of a word in a text file and
replace it with an alternate word. This was my solution. As a new Perl
programmer, I feel like this solution was too C like and not enough Perl like.
So, my question is
Recently, I was asked to find the first occurrence of a word in a text file and
replace it with an alternate word. This was my solution. As a new Perl
programmer, I feel like this solution was too C like and not enough Perl like.
So, my question is what would have been the Perl like solution
in
f[##o]o(ba##r) ?
again, thanks for any ideas and hints,
Frank
On 9 Aug., 02:34, jwkr...@shaw.ca ("John W. Krahn") wrote:
> Frank Müller wrote:
> > dear all,
>
> Hello,
>
> > i want to make some search and replace within a string where I can
> > define a s
Frank Müller wrote:
dear all,
Hello,
i want to make some search and replace within a string where I can
define a set of characters, especially parenthesis, brackets etc.,
which are to be ignored.
For example, I have the following string:
sdjfh sdf sjkdfh sdkjfh sdjkf f[o]o(bar) hsdkjfh
dear all,
i want to make some search and replace within a string where I can
define a set of characters, especially parenthesis, brackets etc.,
which are to be ignored.
For example, I have the following string:
sdjfh sdf sjkdfh sdkjfh sdjkf f[o]o(bar) hsdkjfh sdkljfhs sjfh sdkj
sdjkfh sdjfh
help.I am trying to read the file contents line by
> line and if there are any number in the word (like 1,2,...) then i hav to
> replace that digit by its equivalent in terms of words.
> Ex:if input is hi*5*go
> Output has to be hi*five*go..This changes has to be reflected in original
Hi Folks,
I need an help.I am trying to read the file contents line by
line and if there are any number in the word (like 1,2,...) then i hav to
replace that digit by its equivalent in terms of words.
Ex:if input is hi*5*go
Output has to be hi*five*go..This changes has to be
On 28 avr, 19:12, trevor.do...@gmail.com (Trev) wrote:
> I'm trying to use Perl to replace a line in a few XML files I have.
>
> Example XML below, I'm wanting to change the Id= part from Id="/Local/
> App/App1" to Id=/App1". I know there's an easy wa
Hi,
sorry for the late response.
On Wednesday 28 Apr 2010 20:12:36 Trev wrote:
> I'm trying to use Perl to replace a line in a few XML files I have.
>
> Example XML below, I'm wanting to change the Id= part from Id="/Local/
> App/App1" to Id=/App1". I kno
Trev wrote:
I'm trying to use Perl to replace a line in a few XML files I have.
Example XML below, I'm wanting to change the Id= part from Id="/Local/
App/App1" to Id=/App1". I know there's an easy way to do this with
perl alone however I'm trying to use XML
I'm trying to use Perl to replace a line in a few XML files I have.
Example XML below, I'm wanting to change the Id= part from Id="/Local/
App/App1" to Id=/App1". I know there's an easy way to do this with
perl alone however I'm trying to use XML
From: Erik Lewis
> Thanks that probably explains my higher than expected ungeocoded
> rate. Two weeks of playing with perl and I feel like I know less than
> when I started.
The more you learn the more you find out you know nothing ;-)
This feeling is to be expected. Don't let it overwhelm
v = get("http://maps.google.com/maps/geo?q=$geoaddress&output=csv&sensor=false&key=$googlekey
")
or die 'Unable to get page';
As if I did not think so. No you do not need to replace spaces by
plus signs! You need to escape the string for inclusion in a query
s
ww8R4s0VhTfTt-19vTI9qA-_V1pUf4-_TcfpQ";
> #get your google http://code.google.com/apis/maps/signup.html
>
> my $geocode_csv =
> get("http://maps.google.com/maps/geo?q=$geoaddress&output=csv&sensor=false&key=$googlekey";)
>
> or die 'Unable to get p
On Fri, Feb 19, 2010 at 3:23 PM, John W. Krahn wrote:
> Sergey Matveev wrote:
>>
>> Greetings,
>>
>> On Fri, Feb 19, 2010 at 03:54:27PM -0500, Erik Lewis wrote:
>>
>>> I have to changes all the spaces in a string to +'s. Is there an
>>> easy way to do this. The length of the string and the numbe
space?
To for example replace space and tab runs by a single plus, try this:
s{ [[:blank:]]+ } {+}xg;
which is equivalent to
tr { \t} {+}s;
Example:
perl -wle '
my $var = "abc def \t g";
(my $v1 = $var ) =~ s{ [[:blank:]]+ } {+}xg;
(my $v2 = $var ) =~ tr {
Greetings,
On Fri, Feb 19, 2010 at 02:23:07PM -0800, John W. Krahn wrote:
> You don't have to escape a plus sign in a quoted string:
>
> $string =~ s/ /+/g;
Yeah. I see. I understand my fault.
--
Happy hacking, Sergey Matveev
FSF Associate member #5968 | FSFE Fellow #1390
--
To unsubscribe,
> "SM" == Sergey Matveev writes:
SM> $string =~ s/ /\+/g;
why are you escaping the + there? that is a replacement string, not a
regex. it is double quotish but not much more than that. + is just a
regular char there like almost all chars in double quoted strings.
this is a common thing i
Sergey Matveev wrote:
Greetings,
On Fri, Feb 19, 2010 at 03:54:27PM -0500, Erik Lewis wrote:
I have to changes all the spaces in a string to +'s. Is there an
easy way to do this. The length of the string and the number of
spaces will always be changing.
$string =~ s/ /\+/g;
That is all.
Thanks Sergey,
That was just staring at me in the face.
If anyone is interested a little code to spit back the latitude and longitude
of an address. Next step is to get it too pull the address from a mysql
database and then update it.
#!/usr/bin/perl
use war
Greetings,
On Fri, Feb 19, 2010 at 03:54:27PM -0500, Erik Lewis wrote:
> I have to changes all the spaces in a string to +'s. Is there an easy way to
> do this. The length of the string and the number of spaces will always be
> changing.
$string =~ s/ /\+/g;
That is all. All spaces will b
I have to changes all the spaces in a string to +'s. Is there an easy way to
do this. The length of the string and the number of spaces will always be
changing.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl
From: Noah Garrett Wallach
> okay a step further - is there a way to make the following a one liner?
>
> (my $filename_cmd = $cmd[-1]) =~ s/\|//g;
> $filename_cmd =~ s/\s+/\./g;
> $filename_cmd =~ s/save.*//g;
There's no point in making it a one liner. Plus anything may be
writen
>>>>> "NGW" == Noah Garrett Wallach writes:
NGW> Jim Gibson wrote:
>> At 7:22 PM -0700 9/2/09, Noah Garrett Wallach wrote:
>>> Hi there,
>>>
>>> what is the way to collapse this search/replace to one line?
>>&
Jim Gibson wrote:
At 7:22 PM -0700 9/2/09, Noah Garrett Wallach wrote:
Hi there,
what is the way to collapse this search/replace to one line?
my $filename_cmd = $cmd[-1];
my $filename_cmd =~ s/\s/\./;
(my $filename_cmd = $cmd[-1]) =~ s/\s/\./;
thanks,
okay a step further
At 7:22 PM -0700 9/2/09, Noah Garrett Wallach wrote:
Hi there,
what is the way to collapse this search/replace to one line?
my $filename_cmd = $cmd[-1];
my $filename_cmd =~ s/\s/\./;
(my $filename_cmd = $cmd[-1]) =~ s/\s/\./;
--
Jim Gibson
jimsgib...@gmail.com
--
To
Hi there,
what is the way to collapse this search/replace to one line?
my $filename_cmd = $cmd[-1];
my $filename_cmd =~ s/\s/\./;
Cheers,
Noah
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
> -Original Message-
> From: Shawn H. Corey [mailto:shawnhco...@gmail.com]
> Sent: Monday, August 24, 2009 11:57
> To: Wagner, David --- Senior Programmer Analyst --- CFS
> Cc: Tony Esposito; Beginners Perl
> Subject: Re: one liner in Windows to replace string
> -Original Message-
> From: Shawn H. Corey [mailto:shawnhco...@gmail.com]
> Sent: Monday, August 24, 2009 11:00
> To: Tony Esposito
> Cc: Beginners Perl
> Subject: Re: one liner in Windows to replace string
>
> Tony Esposito wrote:
> > perl -p -i.b
replace string
Looks good but it bombs ... the Perl interpreter crashes from
the DOS prompt ... using version 5.10.0 build 1005 from ActiveState.
I am running AS 5.8.9 and when I run from cmd32.exe, it
never comes back to me again. If I run under MKS Korn shell
replace string
I am happy that it works with double quotes BUT now, when I try
to get all files in a directory with a certain extension, the following
does not work ...
perl -p -i.bak -e "'s/CONSTANT/VARIABLE/'" C:\*.txt
To
> -Original Message-
> From: Tony Esposito [mailto:tony1234567...@yahoo.co.uk]
> Sent: Monday, August 24, 2009 10:46
> To: Beginners Perl
> Cc: tony1234567...@yahoo.co.uk
> Subject: one liner in Windows to replace string
>
> perl -p -i.bak -e 's/CO
Telemachus wrote:
Ok, not to be a jerk, but look at it this way: it's clear that Windows +
one-liners are not going well. In the time we've all gone back and forth on
this, you could have written a 10 line script and run it about 20 times.
Pick your battles, I say.
True, but it means "A Poor
On Mon Aug 24 2009 @ 8:08, Tony Esposito wrote:
> Looks good but it bombs ... the Perl interpreter crashes from the DOS prompt
> ... using version 5.10.0 build 1005 from ActiveState.
>
> But it was better than what I had, that's for sure
>
> This makes for a bit of a mind teaser thanks to it be
ndoze ... :-)
From: Shawn H. Corey
To: Tony Esposito
Cc: "Wagner, David --- Senior Programmer Analyst --- CFS"
; Beginners Perl
Sent: Monday, 24 August, 2009 14:49:47
Subject: Re: one liner in Windows to replace string
Tony Esposito wrote:
> I am happy that it works with double quotes BUT
Ok, I can glob() ...
perl -e "use File::DosGlob qw(glob);print glob('test.*')" # works ok!!
but I can not replace (my syntax is incorrect but where) ...
perl -e "use File::DosGlob qw(glob);'s/CONSTANT/VARIABLE/' glob('test.*
Tony Esposito wrote:
I am happy that it works with double quotes BUT now, when I try to get
all files in a directory with a certain extension, the following does
not work ...
perl -p -i.bak -e "'s/CONSTANT/VARIABLE/'" C:\***.txt
does not like th leading * in the file name when I try to pull
. Corey; Wagner, David --- Senior Programmer Analyst --- CFS
Cc: Beginners Perl
Subject: Re: one liner in Windows to replace string
I am happy that it works with double quotes BUT now, when I try to get all
files in a directory with a certain extension, the following does not work ...
perl -p -i.bak
txt files
...
Help again.
From: Shawn H. Corey
To: "Wagner, David --- Senior Programmer Analyst --- CFS"
Cc: Tony Esposito ; Beginners Perl
Sent: Monday, 24 August, 2009 12:57:27
Subject: Re: one liner in Windows to replace string
Wagner, David
Wagner, David --- Senior Programmer Analyst --- CFS wrote:
I ran under windows with what Tony sent, both the cmd and a korn
shell and both worked and updated as expected..
If you have any questions and/or problems, please let me know.
Thanks.
What version of Windows?
On Mon Aug 24 2009 @ 4:45, Tony Esposito wrote:
> perl -p -i.bak -e 's/CONSTANT/VARIABLE/' C:\test.txt
>
> Trying to replace a string with this one line perl ... in Windows it does not
> seem to work ...
>
> File test.txt contents is ...
>
> CONSTANT 100
&
Tony Esposito wrote:
perl -p -i.bak -e 's/CONSTANT/VARIABLE/' C:\test.txt
Trying to replace a string with this one line perl ... in Windows it does not
seem to work ...
File test.txt contents is ...
CONSTANT 100
CONSTANT 200
nothing changes ... acts as if it does not 'se
perl -p -i.bak -e 's/CONSTANT/VARIABLE/' C:\test.txt
Trying to replace a string with this one line perl ... in Windows it does not
seem to work ...
File test.txt contents is ...
CONSTANT 100
CONSTANT 200
nothing changes ... acts as if it does not 'see' the CONSTANT stri
On Sun Jun 21 2009 @ 7:40, AndrewMcHorney wrote:
> Hello
>
> I have written a perl script and I am in the debugging and imroving the
> code. The first improvement is want to make is to replace the
> system("Dir c:/s") call because it is not portable. So I was told t
Hello
I have written a perl script and I am in the debugging and imroving
the code. The first improvement is want to make is to replace the
system("Dir c:/s") call because it is not portable. So I was told to
use the File package. I have not found a good example. So I am
lookin
Steve Bertrand wrote:
John W. Krahn wrote:
Steve Bertrand wrote:
+sub is_word ($) {
+return unless defined $_[0] && $_[0] ne '';
+return if $_[0] =~ /[\w\s]+/;
+return 1;
+}
The other is_* functions in that module use anchors with their regular
expressions so you probably should
John W. Krahn wrote:
> Steve Bertrand wrote:
>> I wasted about two hours of my coding time trying to come up with a
>> special JAPH, but I just haven't been able to make map() do what I think
>> it should do ;)
>
> What did you think it should do? What did you want it to do?
Originally, I was t
acter class and it has no meaning in a string
context.
If you want to replace a pattern with the value of $_[1] space
characters then you could do this:
s/blah/ ' ' x $_[1] /eg;
The /e option treats the string on the right as Perl code and evaluates
it and returns the result.
Wow
annot put "whitespace" in the string half because whitespace is a
> regular expression character class and it has no meaning in a string
> context.
>
> If you want to replace a pattern with the value of $_[1] space
> characters then you could do this:
>
> s/blah/ ' &
uot;whitespace" in the string half because whitespace is a
regular expression character class and it has no meaning in a string
context.
If you want to replace a pattern with the value of $_[1] space
characters then you could do this:
s/blah/ ' ' x $_[1] /eg;
The /e option
I'm attempting to write a patch for a module that I feel I can use
within one of my own modules, and I've run into something that I can't
solve (I can't come up with the proper query in Google).
Perhaps code will help here. First, I know 'word' does not include
whitespace, and I know that one shou
1 - 100 of 731 matches
Mail list logo