> 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
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
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
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
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",
rl.org>"
<beginners@perl.org<mailto:beginners@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 del
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
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
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 a
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:
On Sat, Feb 1, 2014 at 4:57 AM, Shlomi Fish shlo...@shlomifish.org 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
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 Fish
Hi Irfan Sayed,
Please check my comments below.
On 8/18/12, Irfan Sayed irfan_sayed2...@yahoo.com 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 =~ s/$\(workspace)/c:\\p4\\abc/;
On Fri, 17 Aug 2012 18:02:23 -0700 (PDT)
Irfan Sayed irfan_sayed2...@yahoo.com 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 easy way is to quote
thanks a lot
regards
irfan
From: Shawn H Corey shawnhco...@gmail.com
To: beginners@perl.org
Cc: Irfan Sayed irfan_sayed2...@yahoo.com
Sent: Saturday, August 18, 2012 6:50 AM
Subject: Re: search and replace
On Fri, 17 Aug 2012 18:02:23 -0700 (PDT)
Irfan
Here is the correct version:
#!/usr/bin/perl
$csproj_text = C:\\build.txt;
$csproj_text =~ s/\\//g;
print $csproj_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.
On Thu, Aug 16, 2012 at 10:55 AM, Gergely Buday gbu...@gmail.com wrote:
Here is the correct version:
#!/usr/bin/perl
$csproj_text = C:\\build.txt;
$csproj_text =~ s/\\//g;
print $csproj_text\n;
Notice that in order to put a literal backslash into a perl string,
you should escape
The issue is
$cs_project = C:\build.txt; ## In Double quotes takes the string as
C:build.txt.since its an escape character
That's the reason why Rob suggested to put the string in Single quotes.
Both Gergely and Rob are right.
Cheers,
Midhun
On Thu, Aug 16, 2012 at 2:29 PM, Rob Coops
, 2012 2:41 PM
Subject: Re: search and replace
The issue is
$cs_project = C:\build.txt; ## In Double quotes takes the string as
C:build.txt.since its an escape character
That's the reason why Rob suggested to put the string in Single quotes.
Both Gergely and Rob are right.
Cheers,
Midhun
On Thu, 16 Aug 2012 10:55:03 +0200
Gergely Buday gbu...@gmail.com 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
Sent from my LG phone
John W. Krahn jwkr...@shaw.ca 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
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
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 =
-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 remove all the blank lines?
Output
-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:
But how do I remove all the blank lines
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 same
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/
hi,
thank you for your solution which works perfect for the data i have
given.
the trouble is: my data looks a little more complex as I have lots of
accented characters so with your code I need to specify each of those
characters in the tr/// part. I reckon the other way around would be
more
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
On Nov 12, 6:55 am, [EMAIL PROTECTED] (Rob Dixon) wrote:
[EMAIL PROTECTED] wrote:
Hi I am new to this group and to Perl.
I am having trouble with searching and replacing a pattern in a file
and then
copying to a new file. I am trying to write an interactive program to
do this
where
On Wed, 2008-11-12 at 13:00 -0800, [EMAIL PROTECTED] wrote:
I think I understand most of your suggestions but I'm not very clear
in this line:
print $out $_;# in the while loop below.
while ($in) {
s/\Q$search/$replace/g;
print $out $_;
What is the $_ variable?
The $_
On Nov 12, 6:55 am, [EMAIL PROTECTED] (Rob Dixon) wrote:
[EMAIL PROTECTED] wrote:
Hi I am new to this group and to Perl.
I am having trouble with searching and replacing a pattern in a file
and then
copying to a new file. I am trying to write an interactive program to
do this
where
[EMAIL PROTECTED] wrote:
Hi I am new to this group and to Perl.
I am having trouble with searching and replacing a pattern in a file
and then
copying to a new file. I am trying to write an interactive program to
do this
where I input the file name for the search and replace and the file
On Tue, Nov 11, 2008 at 09:52, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Hi I am new to this group and to Perl.
I am having trouble with searching and replacing a pattern in a file
and then
copying to a new file. I am trying to write an interactive program to
do this
where I input the
On Tue, Nov 11, 2008 at 9:52 AM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Hi I am new to this group and to Perl.
[snip]
#!/usr/bin/perl -w
use strict;
If you really have warnings enabled, you should be seeing lots of
warnings like bareword found where operator expected pointing at
this
On Aug 13, 1:44 pm, [EMAIL PROTECTED] wrote:
Hi,
I am trying to search replace a string in a file using the below
perl command on unix.
perl -pi -e 's/OLD/NEW/g' repltest.txt
But I want the above command to display what lines were replaced. Is
it possible using some switch options? If
On Aug 13, 4:44 pm, [EMAIL PROTECTED] wrote:
Hi,
I am trying to search replace a string in a file using the below
perl command on unix.
perl -pi -e 's/OLD/NEW/g' repltest.txt
But I want the above command to display what lines were replaced. Is
it possible using some switch options? If
On Aug 13, 4:44 pm, [EMAIL PROTECTED] wrote:
Hi,
I am trying to search replace a string in a file using the below
perl command on unix.
perl -pi -e 's/OLD/NEW/g' repltest.txt
But I want the above command to display what lines were replaced. Is
it possible using some switch options? If
El Thursday 14 August 2008 17:30:43 [EMAIL PROTECTED] va escriure:
Xavier,
Thanks for the tip but can you help me by pasting the code too? It
might take 2 mins for you but I will have to fiddle with it longer :(
Regards.
On Aug 14, 6:02 am, [EMAIL PROTECTED] (Xavier Mas) wrote:
El
Xavier,
Thanks for the tip but can you help me by pasting the code too? It
might take 2 mins for you but I will have to fiddle with it longer :(
Regards.
On Aug 14, 6:02 am, [EMAIL PROTECTED] (Xavier Mas) wrote:
El Wednesday 13 August 2008 22:44:11 [EMAIL PROTECTED] va escriure:
Hi,
I
On Wed, 2008-08-13 at 13:44 -0700, [EMAIL PROTECTED] wrote:
Hi,
I am trying to search replace a string in a file using the below
perl command on unix.
perl -pi -e 's/OLD/NEW/g' repltest.txt
But I want the above command to display what lines were replaced. Is
it possible using some
El Wednesday 13 August 2008 22:44:11 [EMAIL PROTECTED] va escriure:
Hi,
I am trying to search replace a string in a file using the below
perl command on unix.
perl -pi -e 's/OLD/NEW/g' repltest.txt
But I want the above command to display what lines were replaced. Is
it possible using
Joseph L. Casale wrote:
From: Rob Dixon
Joseph L. Casale wrote:
One of these scripts has a loop like this:
for my $line (@lines){
my $line2 = $line;
$line =~ s/(\S+)\s+(\S+)\s+(\S+)/X$1 Y$2/;
print FILEOUT $line;
$line2 =~ s/(\S+)\s+(\S+)\s+(\S+)/Z[$3+DPad]/;
print FILEOUT $line2;
Chas Owens schreef:
print $out
X$x Y$y\n,
Z[$z+DPad]\n,
M98PDRILL.SUBL1\n,
G90\n,
G00 Z[CPlane]\n;
Never use multiple print statements when you can use just one.
In general that's true, but because of the Never I have to object. :)
Sometimes
Joseph L. Casale wrote:
OK, I saw your example and noted it. I intended on using next time as I know
there will be:)
But now I am convinced, as the lack of error checking in my script worries me.
I'll take yours and fit it in!
I do need to read up on what you're doing as I am not clear on its
On 7/14/07, Dr.Ruud [EMAIL PROTECTED] wrote:
snip
Never use multiple print statements when you can use just one.
In general that's true, but because of the Never I have to object. :)
Sometimes multiple print statements look like only one, I am thinking of
the print for LIST construct.
Chas Owens wrote:
By the way, an easier way to write the join version is
print map { $_\n } @list;
BTW, that's not the same. Join inserts its string between each element,
map (in this case) appends it to the end. A subtle difference that may
lead to confusion and errors.
--
Just my
On 7/14/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote:
Chas Owens wrote:
By the way, an easier way to write the join version is
print map { $_\n } @list;
BTW, that's not the same. Join inserts its string between each element,
map (in this case) appends it to the end. A subtle difference
Chas Owens wrote:
The code I am referring to is
print +(join \n, @LIST), \n ;
Which does the same thing as
print map { $_\n } @list;
The only difference between them is if $, is set.
True, in this case they are.
But the way you stated your preferences implied they are the same, or at
Chas Owens wrote:
On 7/14/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote:
Chas Owens wrote:
By the way, an easier way to write the join version is
print map { $_\n } @list;
BTW, that's not the same. Join inserts its string between each element,
map (in this case) appends it to the end.
Rob Dixon wrote:
Chas Owens wrote:
On 7/14/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote:
Chas Owens wrote:
By the way, an easier way to write the join version is
print map { $_\n } @list;
BTW, that's not the same. Join inserts its string between each element,
map (in this case)
On 7/14/07, Rob Dixon [EMAIL PROTECTED] wrote:
Chas Owens wrote:
On 7/14/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote:
Chas Owens wrote:
By the way, an easier way to write the join version is
print map { $_\n } @list;
BTW, that's not the same. Join inserts its string between each
One of these scripts has a loop like this:
for my $line (@lines){
my $line2 = $line;
$line =~ s/(\S+)\s+(\S+)\s+(\S+)/X$1 Y$2/;
print FILEOUT $line;
$line2 =~ s/(\S+)\s+(\S+)\s+(\S+)/Z[$3+DPad]/;
print FILEOUT $line2;
print FILEOUT M98PDRILL.SUBL1\n;
print FILEOUT G90\n;
print FILEOUT G00
On 7/13/07, Joseph L. Casale [EMAIL PROTECTED] wrote:
What would be a wise way of trapping a condition such as the line read and
passed
into the loop is not 3 sets of numbers and if so, skip?
Use the 'next' operator. It's documented in perlfunc.
Hope this helps!
--Tom Phoenix
Stonehenge
Joseph L. Casale wrote:
One of these scripts has a loop like this:
for my $line (@lines){
my $line2 = $line;
$line =~ s/(\S+)\s+(\S+)\s+(\S+)/X$1 Y$2/;
print FILEOUT $line;
$line2 =~ s/(\S+)\s+(\S+)\s+(\S+)/Z[$3+DPad]/;
print FILEOUT $line2;
print FILEOUT M98PDRILL.SUBL1\n;
print FILEOUT
Joseph L. Casale wrote:
One of these scripts has a loop like this:
for my $line (@lines){
my $line2 = $line;
$line =~ s/(\S+)\s+(\S+)\s+(\S+)/X$1 Y$2/;
print FILEOUT $line;
$line2 =~ s/(\S+)\s+(\S+)\s+(\S+)/Z[$3+DPad]/;
print FILEOUT $line2;
print FILEOUT M98PDRILL.SUBL1\n;
print FILEOUT
Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Friday, July 13, 2007 7:09 PM
To: beginners@perl.org
Cc: Joseph L. Casale
Subject: Re: Search and Replace
Joseph L. Casale wrote:
One of these scripts has a loop like this:
for my $line (@lines){
my $line2 = $line;
$line =~ s/(\S
On 7/13/07, Joseph L. Casale [EMAIL PROTECTED] wrote:
snip
open (FILEIN, $ARGV[0]) or die $!;
my @lines = FILEIN;
snip
In list context the operatot returns all lines, but in scalar
context it returns on line at a time. This can be used with a while
loop to walk over the file in pieces (a
: Wednesday, July 11, 2007 4:52 PM
To: Joseph L. Casale
Cc: beginners@perl.org
Subject: Re: Search and Replace
Joseph L. Casale wrote:
Paul,
Reading the perlre doc I am starting to understand this line:
$line =~ s/(\S+)\s+(\S+)\s+(\S+)/X$1 Y$2 Z$3/;
I have a few questions.
1. What is the tilde
Joseph L. Casale wrote:
How can I make this expression:
$line =~ s/(\S+)\s+(\S+)\s+(\S+)/X$1 Y$2 Z$3/
Add some numerical value to the Z$3 part, so if $3
was 3.14, I want it to be Z4.14 for example by adding 1 to it.
May I reply amending my original solution to your problem, which seems to me
Ok Rob,
I'll have a look.
Thanks!
jlc
-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 12, 2007 1:22 PM
To: beginners@perl.org
Cc: Joseph L. Casale
Subject: Re: Search and Replace
Joseph L. Casale wrote:
How can I make this expression:
$line =~ s/(\S
On 7/12/07, Joseph L. Casale [EMAIL PROTECTED] wrote:
Hi All,
How can I make this expression:
$line =~ s/(\S+)\s+(\S+)\s+(\S+)/X$1 Y$2 Z$3/
Add some numerical value to the Z$3 part, so if $3 was 3.14, I want it to be
Z4.14 for example by adding 1 to it.
Use the e option to turn the
From: Joseph L. Casale [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 11, 2007 1:51 PM
To: beginners@perl.org
Subject: Search and Replace
Hi,
Know that I am learning perl, I am expected to use it at work :)
Problem is I am still to green for the current problem I have. The data
is always left
On Jul 11, 1:50 pm, [EMAIL PROTECTED] (Joseph L. Casale)
wrote:
Hi,
Know that I am learning perl, I am expected to use it at work :)
Problem is I am still to green for the current problem I have. The data is
always left justified and has a space between each value.
I have a text file of
To: beginners@perl.org
Subject: Re: Search and Replace
On Jul 11, 1:50 pm, [EMAIL PROTECTED] (Joseph L. Casale)
wrote:
Hi,
Know that I am learning perl, I am expected to use it at work :)
Problem is I am still to green for the current problem I have. The data is
always left justified and has
Joseph L. Casale wrote:
Hi,
Know that I am learning perl, I am expected to use it at work :)
Problem is I am still to green for the current problem I have. The data is
always left justified and has a space between each value.
I have a text file of about ~500 lines like this:
-11.67326 23.95923
-Original Message-
From: Paul Lalli [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 11, 2007 12:30 PM
To: beginners@perl.org
Subject: Re: Search and Replace
On Jul 11, 1:50 pm, [EMAIL PROTECTED] (Joseph L. Casale)
wrote:
Hi,
Know that I am learning perl, I am expected to use it at work :)
Problem
Joseph L. Casale wrote:
Paul,
Reading the perlre doc I am starting to understand this line:
$line =~ s/(\S+)\s+(\S+)\s+(\S+)/X$1 Y$2 Z$3/;
I have a few questions.
1. What is the tilde for?
From `perldoc perlop`:
Binding Operators
Binary =~ binds a scalar expression to a
Hello,
I would like to search content of file and as a pattern to use hash, but
I can't find out how to do that.
Situation:
%hash = ( key1 = value1,
...
keyn = valuen);
Hello,
Here it's easy to access the hash's value via its key,simply as:
$hash{key1};
I think you would want
On 2/10/06, Ken Hill [EMAIL PROTECTED] wrote:
I have the following perl script that reads a fixed-width file and
replaces values in various sections of the file.
---
open (IN, ' in.txt');
open (OUT, ' out_test.txt');
while (IN) {
chomp;
On 2/10/06, Chas Owens [EMAIL PROTECTED] wrote:
On 2/10/06, Ken Hill [EMAIL PROTECTED] wrote:
I have the following perl script that reads a fixed-width file and
replaces values in various sections of the file.
---
open (IN, ' in.txt');
open
Ken Hill wrote:
I have the following perl script that reads a fixed-width file and
replaces values in various sections of the file.
---
open (IN, ' in.txt');
open (OUT, ' out_test.txt');
You should verify that the files were opened successfully
On Oct 28, Matthias Leopold said:
i want to search for a pattern in html text and replace only those occurences
that are not enclosed inside (html tag, not perl operator).
It's easiest to use a real HTML parser. Otherwise, you'll probably get
false positives and what-not.
$string =~
On Jul 23, Tom Allison said:
($lineExtract, $_) = /(^\w+\.dat\|)(.+)$/o;
(I like to add the regex option 'o' at the end to improve performance.)
This is a common misconception. The purpose and effects of the /o
modifier (as well as the /s and /m modifiers) are unclear to a lot of Perl
Jeff 'japhy' Pinyan wrote:
On Jul 23, Tom Allison said:
($lineExtract, $_) = /(^\w+\.dat\|)(.+)$/o;
(I like to add the regex option 'o' at the end to improve performance.)
This is a common misconception. The purpose and effects of the /o
modifier (as well as the /s and /m modifiers) are
On Jul 23, Tom Allison said:
Jeff 'japhy' Pinyan wrote:
The /o modifier tells the internal regex compiler that, after this regex has
been compiled 'o'nce, it is never to be compiled again. Well, what good is
that? you ask. For your average regex, there is absolutely no difference,
no
On Jul 22, Brent Clark said:
Think I have a better unstanding of the use of () for my regex search, but
this morning I have a new set of problems, whereby I need to perform a search
and replace and then pass on to the new variable.
My current code is as so, and works:
$_ =~
Brent Clark wrote:
Hi all
Think I have a better unstanding of the use of () for my regex search,
but this morning I have a new set of problems, whereby I need to perform
a search and replace and then pass on to the new variable.
My current code is as so, and works:
$_ =~ s/(^\w+\.dat\|)//;
Subject: search and replace confusion
What I'm trying to do with the following code is convert
some iCal files so that a specific application will read
them.
The problem is that this application can't deal with
entries that have a date but no time.
(Full examples below.) For example, if I have
Jason Balicki wrote:
What I'm trying to do with the following code is convert
some iCal files so that a specific application will read
them.
The problem is that this application can't deal with
entries that have a date but no time.
(Full examples below.) For example, if I have a
Wagner, David --- Senior Programmer Analyst --- WGO
mailto:[EMAIL PROTECTED] wrote:
The above seems to be what you stated you wanted. I did nothing
else in processing. I am running on AS Perl 5.8.3 build 809
Thanks, any guesses as to what's wrong with my outer
loop?
--J(K)
--
To
Jason Balicki wrote:
Wagner, David --- Senior Programmer Analyst --- WGO
mailto:[EMAIL PROTECTED] wrote:
The above seems to be what you stated you wanted. I did nothing
else in processing. I am running on AS Perl 5.8.3 build 809
Thanks, any guesses as to what's wrong with my outer
Jason Balicki mailto:[EMAIL PROTECTED] wrote:
: in the file, I want to convert it to:
:
: DTSTART:20050616T07Z
:
: But with my code below this line prints as:
:
: T07Z20050616
:
: overwriting instead of appending the time value.
Not when I tried it. It was appended.
I did
Wagner, David --- Senior Programmer Analyst --- WGO
are the files you are processing from the same environment or a
different one? If different, then it might be invalid translation of
Well, I'm processing from a Linux box, and the files are created
on the same box, however your comment tipped
Hello All
I'm tryiing to search and replace in both perl and korn shell.
For Example:
X=G1234V00
I want to replace all occurences of 'V' with 'v' in both perl and korn shell
William Black
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi,
do
perl -pi -e 's/Old_value/new_value/g' Our_File
Bye
-Original Message-
From: William Black [mailto:[EMAIL PROTECTED]
Sent: sexta-feira, 7 de Janeiro de 2005 14:42
To: beginners@perl.org
Subject: re: Search And Replace
Hello All
I'm tryiing to search and replace in both perl
-Original Message-
From: William Black [mailto:[EMAIL PROTECTED]
Sent: Friday, January 07, 2005 08:42
To: beginners@perl.org
Subject: re: Search And Replace
Hello All
I'm tryiing to search and replace in both perl and korn shell.
For Example:
X=G1234V00
I want
Subject: re: Search And Replace
Hello All
I'm tryiing to search and replace in both perl and
korn shell.
For Example:
X=G1234V00
I want to replace all occurences of 'V' with 'v'
in both perl
and korn shell
William Black
In Perl, you can use ucase and lcase
Mallik [EMAIL PROTECTED] wrote:
: I have the below string.
:
: $str = iabd a bdkf a kdfkj akdfakjkf;
:
: I want to replace all the 'a' s prceeded and
: followed by spaces with 'A'.
:
: The output should be like this
:
: $str = iabd Abdkf A kdfkj akdfakjkf;
:
: Any easy reg exp?
Hi,
For replacing the contents of an array :
This code snippet replaces the string MODIFIED by MOD
foreach(@arr) {
s/MODIFIED/MOD/g;
}
foreach(@arr) {
print $_\n;
}
This is a round about way of assigning values of one array to another.
#!/usr/bin/perl -w
@arr1 = (This,is,something,cool);
@arr2 =
On Tue, 2004-07-20 at 15:42, Baskaran wrote:
Dear sir,
I have two array variables. I want to find $a[1] and replace $b[1] in a
file.
($a[1],$b[1] are array variables)
How to find and replace the variable contents.
for ($i=0;$i$totalnum;$i++){
s/$a[i]/$b[i]/g;
}
You have almost
Dear sir,
I have two array variables. I want to find $a[1] and replace $b[1] in a
file.
($a[1],$b[1] are array variables)
How to find and replace the variable contents.
for ($i=0;$i$totalnum;$i++){
s/$a[i]/$b[i]/g;
}
Is it possible to do search and replace or kindly suggest me an idea
rmck wrote:
But I run this system call and it took allnight to run :(
You were asking perl to rewrite the whole file for every line
you wanted to change.
#!/usr/bin/perl
use strict;
use warnings;# or just use Foo::Monkey :-)
use POSIX qw(strftime);
die Usage: $0 FILES\n
On Jan 22, 2004, at 10:13 AM, rmck wrote:
Hi
Hello.
This scripts sucks in a 109mb file and i'm trying to do a search and
replace on unxtime to the format from strftime. Which is working...
But I run this system call and it took allnight to run :(
So I killed it... Any other suggestions to
Hi
This scripts sucks in a 109mb file and i'm trying to do a
search and replace on unxtime to the format from strftime.
Which is working...
But I run this system call and it took allnight to run :(
So I killed it... Any other suggestions to reach my goal.
Yes it looks
Steve Grazzini wrote:
rmck wrote:
But I run this system call and it took allnight to run :(
You were asking perl to rewrite the whole file for every line
you wanted to change.
#!/usr/bin/perl
use strict;
use warnings;# or just use Foo::Monkey :-)
use POSIX
I think you will like this, it does exactly whay you described...
perl -pi.bak 's|ReplaceThis|WithThis|' *
This does everything you want, AND makes a backup of each file. You can
only perform a substitution on a single line though (AFAIK).
See perldoc perlrun for all of the details.
WARNING:
Sorry, my bad. Forgot the -e switch...
perl -pi.bak -e 's|ReplaceThis|WithThis|' *
Rob
-Original Message-
From: Hanson, Rob
Sent: Monday, January 19, 2004 8:04 PM
To: 'Perl'; [EMAIL PROTECTED]
Subject: RE: Search and replace pattern in a file
I think you will like this, it does
Saju Palayur wrote:
Hi
I am trying to do some thing like this, but am getting the wrong
output. Can somebody tell if my regular expression is wrong or not?
-Perl script---
$line = ABCXYZGwcTI\\ABCXYZIntValTI;
$line=~s/ABCXYZ(.*)TI/Hello$1/g;
Saju Palayur wrote:
Hi
I am trying to do some thing like this, but am getting the wrong output.
Can somebody tell if my regular expression is wrong or not?
-Perl script---
$line = ABCXYZGwcTI\\ABCXYZIntValTI;
$line=~s/ABCXYZ(.*)TI/Hello$1/g;
1 - 100 of 132 matches
Mail list logo