Hi,
It's possible to build in Perl a Regular Expression to grab a pattern that
extends by two lines ?
I want to read a file and know if it's a email message or not, fetching the
first Message-Id found. The problem is that some email clients put the
Message-Id tag in one line, like this
Lívio Cipriano wrote:
Hi,
Hello,
It's possible to build in Perl a Regular Expression to grab a pattern that
extends by two lines ?
Yes it is.
I want to read a file and know if it's a email message or not, fetching the
first Message-Id found. The problem is that some email clients put the
On Wed, May 25, 2011 at 07:39:28 -0700 , Irfan Sayed wrote:
hi,
i have string like this
2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25
i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working
code is like this
$lin = 2011/05/25 07:24:58 -0700 PDT;
$lin =~
hi,
i have string like this
2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25
i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working
code is like this
$lin = 2011/05/25 07:24:58 -0700 PDT;
$lin =~ m/^\d\d\d\d//\d\d/\d\d$/;
print $lin\n;
plz suggest
consider the environment before printing this email-Original
Message-
From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com]
Sent: Wednesday, May 25, 2011 4:39 PM
To: Perl Beginners
Subject: reg exp
hi,
i have string like this
2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25
i wrote
thanks it worked
From: Marco van Kammen mvankam...@mirabeau.nl
To: Irfan Sayed irfan_sayed2...@yahoo.com; Perl Beginners beginners@perl.org
Sent: Wednesday, May 25, 2011 8:22 PM
Subject: RE: reg exp
Surely not perfect but this seems to work...
$lin = 2011/05
At 7:39 AM -0700 5/25/11, Irfan Sayed wrote:
hi,
i have string like this
2011/05/25 07:24:58 -0700 PDT i need
to match 2011/05/25
i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$
but it is not working
code is like this
$lin = 2011/05/25
07:24:58 -0700 PDT;
$lin =~
On 11-05-25 10:39 AM, Irfan Sayed wrote:
hi,
i have string like this
2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25
i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working
code is like this
$lin = 2011/05/25 07:24:58 -0700 PDT;
$lin =~ m/^\d\d\d\d//\d\d/\d\d$/;
print
On 25/05/2011 15:39, Irfan Sayed wrote:
hi,
i have string like this
2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25
i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working
code is like this
$lin = 2011/05/25 07:24:58 -0700 PDT;
$lin =~
hi,
suppose i have a string that contains n number of date patterns in the
string.
2011/05/25 07:24:58 -0700 PDT 2011/04/28 2023/23/45
how can i extract all such patterns.
On Wed, May 25, 2011 at 10:08 PM, Rob Dixon rob.di...@gmx.com wrote:
On 25/05/2011 15:39, Irfan Sayed
At 8:11 AM +0530 5/26/11, Abhinav Kukreja wrote:
hi,
suppose i have a string that contains n number of date patterns in the
string.
2011/05/25 07:24:58 -0700 PDT 2011/04/28 2023/23/45
how can i extract all such patterns.
Use a regular expression that matches just those
On 2011-05-25 16:39, Irfan Sayed wrote:
i have string like this
2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25
i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working
code is like this
$lin = 2011/05/25 07:24:58 -0700 PDT;
$lin =~ m/^\d\d\d\d//\d\d/\d\d$/;
print
Hi,
I'm trying to make a regexp to match the last appearance of a word (lets say
'abc') until the first appearance of another word (for ex: 'xyz'), and I
still cannot do it.
For example: with a string like this abc abc abc toto toto xyz xyz xyz ,
which regexp I have to use to get abc toto toto
You need to specify that the string you look for should not appear in
the part you try to extract, meaning instead of .*? you should be
looking for (not abc)*? In perl, we have the negative lookahed for
that: (?!...): m/abc((.(?!abc))*?)xyz/
However, this would fail if you have a string abc
All this and more is available at http://perldoc.perl.org/perlre.html
On 27 April 2010 12:39, Erez Schatz moonb...@gmail.com wrote:
You need to specify that the string you look for should not appear in
the part you try to extract, meaning instead of .*? you should be
looking for (not abc)*? In
HolyNoob wrote:
Hi,
Hello,
I'm trying to make a regexp to match the last appearance of a word (lets say
'abc') until the first appearance of another word (for ex: 'xyz'), and I
still cannot do it.
For example: with a string like this abc abc abc toto toto xyz xyz xyz ,
which regexp I have
Thanks everyone,
The solution of John W. Krahn works perfectly :) Incredible
On Tue, Apr 27, 2010 at 1:41 PM, John W. Krahn jwkr...@shaw.ca wrote:
HolyNoob wrote:
Hi,
Hello,
I'm trying to make a regexp to match the last appearance of a word (lets
say
'abc') until the first
Hi,
I'm trying to do this:
in the original text is this:
((se-HomePage|Svenska))
I want to leave it at just:
Svenska
So I tried this:
$row[3] =~ s|\(\(.*?\|(.*?)\)\)|$1|g;
but somehow after substituting it now shows:
((se-HomePage|Svenska
I don't get it.
Someone here?
Thanks!
--
Lex
Lex Thoonen wrote:
Hi,
I'm trying to do this:
in the original text is this:
((se-HomePage|Svenska))
I want to leave it at just:
Svenska
So I tried this:
$row[3] =~ s|\(\(.*?\|(.*?)\)\)|$1|g;
but somehow after substituting it now shows:
((se-HomePage|Svenska
I don't
Lex Thoonen wrote:
Hi,
I'm trying to do this:
in the original text is this:
((se-HomePage|Svenska))
I want to leave it at just:
Svenska
So I tried this:
$row[3] =~ s|\(\(.*?\|(.*?)\)\)|$1|g;
but somehow after substituting it now shows:
((se-HomePage|Svenska
I don't get it.
$ perl
[EMAIL PROTECTED] wrote:
Hi all,
Hello,
I have a string which contains spaces. I need to replace those spaces
with underscore, so I have written command like this
$string=fsdfsdfsdf fsdfsdfsdf;
chomp($string1 = ($string =~ s/\s+$/_/g));
\s+$ matches one or more of any whitespace
use strict;
use warnings;
my $string=fsdfsdfsdf fsdfsdfsdf;
my ($a,$b)=split(/\s+/,$string);
my $new_string=$a._.$b;
print $new_string.\n;
Regards
Anirban Adhikary.
On Mon, Nov 3, 2008 at 2:15 PM, John W. Krahn [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
Hi all,
Hello,
I have a
Hi all,
I have a string which contains spaces. I need to replace those spaces
with underscore, so I have written command like this
$string=fsdfsdfsdf fsdfsdfsdf;
chomp($string1 = ($string =~ s/\s+$/_/g));
print $string1\n;
but still $string1 is not printing proper result. Result should
be in the
following format.
For example:- 1,2,3 OR 1 2 3
Which means that delimiter between these figures should be comma OR
space. No any other character. I need all users to adhere that and if
they not then they should exit.
Can somebody please give me reg. exp. which can be used
But I don’t want to match 12,2, or 234432 53. I want to match whether string
contains 1 2 OR 1,2 OR 1,2,3 OR 1 2 3 Or any such combinations.
And I think this reg. exp. is doing that job.
-Original Message-
From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14
Thanks really
-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14, 2008 6:31 PM
To: Perl Beginners
Cc: Sayed, Irfan (Cognizant)
Subject: Re: Regarding reg. exp.
[EMAIL PROTECTED] wrote:
From: Rob Dixon [mailto:[EMAIL PROTECTED]
[EMAIL PROTECTED
[EMAIL PROTECTED] пишет:
if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/)
this what I did.
Hi!
Why have you used {1} quantifier?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Dr.Ruud wrote:
Rob Dixon schreef:
my $re = qr/^
\d+
(?:
(?:,\d+)* | (?: \d+)*
)
$/x;
chomp (my $input = );
if ($input =~ $re) {
print ok\n;
}
else {
print invalid\n;
}
One problem: the space in (?: \d+)* is eaten by the x-modifier.
I would normally use
[EMAIL PROTECTED] schreef:
if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/)
As long as you understand that \s matches SPC, TAB, CR, NL and several
other characters, and \d matches [0-9] and many other characters, and
how one day that will bite you, feel free to use \s and \d.
(I would use neither \s nor
Because I want comma (,) exactly once
-Original Message-
From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14, 2008 4:41 PM
To: Sayed, Irfan (Cognizant)
Cc: [EMAIL PROTECTED]; beginners@perl.org
Subject: Re: Regarding reg. exp.
[EMAIL PROTECTED] пишет
[EMAIL PROTECTED] пишет:
Because I want comma (,) exactly once
-Original Message-
From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14, 2008 4:41 PM
To: Sayed, Irfan (Cognizant)
Cc: [EMAIL PROTECTED]; beginners@perl.org
Subject: Re: Regarding reg. exp.
[EMAIL
if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/)
this what I did.
-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Monday, October 13, 2008 6:49 PM
To: Perl Beginners
Cc: Sayed, Irfan (Cognizant)
Subject: Re: Regarding reg. exp.
[EMAIL PROTECTED] wrote:
I have a string and I
[EMAIL PROTECTED] schreef:
For example:- 1,2,3 OR 1 2 3
I assume it should also work on
132,45,16
but should it also work on
132, 45, 16
or on
0132,-45,16E0,0x03
etc. ?
See Regexp::Common.
--
Affijn, Ruud
Gewoon is een tijger.
--
To unsubscribe, e-mail: [EMAIL
Which means that delimiter between these figures should be comma OR
space. No any other character. I need all users to adhere that and if
they not then they should exit.
Can somebody please give me reg. exp. which can be used to parse the
string and check whether comma OR space
format.
For example:- 1,2,3 OR 1 2 3
Which means that delimiter between these figures should be comma OR
space. No any other character. I need all users to adhere that and if
they not then they should exit.
Can somebody please give me reg. exp. which can be used to parse the
string
Rob Dixon schreef:
my $re = qr/^
\d+
(?:
(?:,\d+)* | (?: \d+)*
)
$/x;
chomp (my $input = );
if ($input =~ $re) {
print ok\n;
}
else {
print invalid\n;
}
One problem: the space in (?: \d+)* is eaten by the x-modifier.
I would normally use [[:blank:]], but in this case
that delimiter between these figures should be comma OR
space. No any other character. I need all users to adhere that and if
they not then they should exit.
Can somebody please give me reg. exp. which can be used to parse the
string and check whether comma OR space is there or not as a delimiter
Hi All,
I have string like OMS.FD.08.03.000.0 Now my req. is that if the string
contains .0 at the end then I want to remove that .0 but if any other
digit is there other than .0 then don't do anything.
For example: if string is : OMS.FD.08.03.000.0 then regular expression
should give
On Mon, Apr 21, 2008 at 7:17 AM, [EMAIL PROTECTED] wrote:
snip
I have string like OMS.FD.08.03.000.0 Now my req. is that if the string
contains .0 at the end then I want to remove that .0 but if any other
digit is there other than .0 then don't do anything.
snip
What have you tried so far?
On Mon, Apr 21, 2008 at 7:17 PM, [EMAIL PROTECTED] wrote:
Hi All,
I have string like OMS.FD.08.03.000.0 Now my req. is that if the string
contains .0 at the end then I want to remove that .0 but if any other
digit is there other than .0 then don't do anything.
For example: if
[EMAIL PROTECTED] wrote:
I have string like OMS.FD.08.03.000.0 Now my req. is that if the string
contains .0 at the end then I want to remove that .0 but if any other
digit is there other than .0 then don't do anything.
For example: if string is : OMS.FD.08.03.000.0 then regular expression
Hi,
How do I write the expression, if the variable match between 0 to 10? Below is
the wrong expression I wrote which is suppose to be if $eightdecks match 0 to
10. So i want the answer to be yes.
Thanks
my $eightdecks = 6;
if($eightdecks =~ /[0-10]/){
print Yes match\n;
}else{print no};
try this one:
# perl -Mstrict -le 'my $x=shift; print 1 if $x=~/^[0-9]$|^10$/' 10
1
On 4/2/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi,
How do I write the expression, if the variable match between 0 to 10? Below
is the wrong expression I wrote which is suppose to be if $eightdecks
PROTECTED]
Sent: Wednesday, April 02, 2008 2:09 PM
To: beginners@perl.org
Subject: how to write 0 to 10 in reg exp.
Hi,
How do I write the expression, if the variable match between 0 to 10? Below
is the wrong expression I wrote which is suppose to be if $eightdecks match
0 to 10. So i want
D. Bolliger [EMAIL PROTECTED] wrote:oryann9 am Montag, 18. Dezember
2006 19:52:
D. Bolliger wrote:
[snipped]
How are my quesitons unclear???
[snipped]
I answered offlist. Sorry to all for the noise of this notice.
Dani
Anyway. When you print $dub_values and it shows up as an array ref as
ARRAY(0x4002c164)
and you want the values of this arrayref, you have to dereference it in some
way.
Start with printing out @$dub_values.
Or assign it before if you want bigger freedom to format the values:
my @[EMAIL
oryann9 [EMAIL PROTECTED] wrote:
Here is my question
I have a line of code like so: $dub_key = $dub_values\n;
that prints
dubhpr28.hpux = ARRAY(0x4002e1bc)
but I want to have printed out the values contained in the $dub_values
arrayref instead of its address.
What do I have to change
Hello...
I have thought about this one and tried various code changes but cannot get
what I want.
My problem: mismatched UIDs in password files.
My solution:
#1 store passwd files in a globbed array
#2 create array reference from globbed array
#3 open array ref, create hash with more than
oryann9 am Montag, 18. Dezember 2006 16:55:
Hello...
I have thought about this one and tried various code changes but cannot
get what I want.
My problem: mismatched UIDs in password files.
My solution:
#1 store passwd files in a globbed array
#2 create array reference from globbed array
D. Bolliger [EMAIL PROTECTED] wrote:
I guess the reason why you got no answer when you posted the identical
question in a recent thread is because, at least
- your question(s) is/are unclear
- your code is not trimmed - even not from comments
Anyway. When you print $dub_values and it shows
oryann9 am Montag, 18. Dezember 2006 19:52:
D. Bolliger [EMAIL PROTECTED] wrote:
[snipped]
How are my quesitons unclear???
[snipped]
I answered offlist. Sorry to all for the noise of this notice.
Dani
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
Dr.Ruud [EMAIL PROTECTED] wrote:Lawrence Statton XE2/N1GAK schreef:
@{$aref2}[0] is 'sun'
ITYM:
${$aref2}[0] is 'sun'
--
Affijn, Ruud
Gewoon is een tijger.
--
Ok everyone, I have thought about this one and tried various code changes but
cannot get what I want.
My
oryann9 [EMAIL PROTECTED] wrote:
Dr.Ruud wrote: Lawrence Statton XE2/N1GAK schreef:
@{$aref2}[0] is 'sun'
ITYM:
${$aref2}[0] is 'sun'
--
Affijn, Ruud
Gewoon is een tijger.
--
Ok everyone, I have thought about this one and tried various code changes but
cannot get what I want.
My
oryann9 [EMAIL PROTECTED] wrote:oryann9 [EMAIL PROTECTED] wrote:
Dr.Ruud wrote: Lawrence Statton XE2/N1GAK schreef:
@{$aref2}[0] is 'sun'
ITYM:
${$aref2}[0] is 'sun'
--
Affijn, Ruud
Gewoon is een tijger.
--
Ok everyone, I have thought about this one and tried various code
Ahh, good catch
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
--- Lawrence Statton XE2/N1GAK [EMAIL PROTECTED]
wrote:
If you're dealing with variable length strings,
separated by some kind
of character, then regexp is the tool you want, not
substr.
This snippet will work so long as hostname and
platform name are made
up of \w ... if not, substitute
Derek B. Smith mailto:[EMAIL PROTECTED] wrote:
: I then tried
Try something simpler, not more complex. Test this case.
my @hosts = ( 'sun' );
$worksheet-write_col( 'A2', [EMAIL PROTECTED], $sheet_format );
If it fails testing then there may be a problem with
write_col() or with the
--- Lawrence Statton XE2/N1GAK [EMAIL PROTECTED]
I am using Spreadsheet::WriteExcel to populate certain
columns which is working, but in column A for example
I am using the method write_col which requires a
reference,
Not just a reference but an ARRAY reference for all the values that
will
--- Lawrence Statton XE2/N1GAK [EMAIL PROTECTED]
wrote:
--- Lawrence Statton XE2/N1GAK
[EMAIL PROTECTED]
I am using Spreadsheet::WriteExcel to populate
certain
columns which is working, but in column A for
example
I am using the method write_col which requires a
reference,
Not
--- Charles K. Clarkson [EMAIL PROTECTED]
wrote:
Derek B. Smith mailto:[EMAIL PROTECTED]
wrote:
: I then tried
Try something simpler, not more complex. Test
this case.
my @hosts = ( 'sun' );
$worksheet-write_col( 'A2', [EMAIL PROTECTED], $sheet_format
);
If it fails
I want to extend any apologies necessary for my last
post. I am not a violent person its just I get
annoyed when some people are negative, or to me, are
condescending. I was not mad just upset and bothered.
No biggy and the past is in the past. : )
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
Lawrence Statton XE2/N1GAK schreef:
@{$aref2}[0] is 'sun'
ITYM:
${$aref2}[0] is 'sun'
--
Affijn, Ruud
Gewoon is een tijger.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
I have a string like so:
/home/dbsmith/passwd.oftappp1.hpux and I need to parse
out oftappp1 and hpux.
I have tried to use substr and and regexp with =~.
Here is what I have tried, but need some help cause I
am getting frustrated.
NOTE: strings after passwd are variable in length,
could be 3-10
Derek B. Smith am Dienstag, 12. Dezember 2006 23:19:
I have a string like so:
/home/dbsmith/passwd.oftappp1.hpux and I need to parse
out oftappp1 and hpux.
I have tried to use substr and and regexp with =~.
Here is what I have tried, but need some help cause I
am getting frustrated.
Derek B. Smith wrote:
I have a string like so:
/home/dbsmith/passwd.oftappp1.hpux and I need to parse
out oftappp1 and hpux.
I have tried to use substr and and regexp with =~.
Here is what I have tried, but need some help cause I
am getting frustrated.
NOTE: strings after passwd are
If you're dealing with variable length strings, separated by some kind
of character, then regexp is the tool you want, not substr.
This snippet will work so long as hostname and platformname are made
up of \w ... if not, substitute in an appropriate character class.
#!/usr/bin/perl
use strict;
or just:
my $filename=/home/dbsmith/passwd.duby02.linux;
my ($pass,$hostname,$platform)=split /\./, $filename;
~i
On 12/12/06, Lawrence Statton XE2/N1GAK [EMAIL PROTECTED] wrote:
If you're dealing with variable length strings, separated by some kind
of character, then regexp is the tool you
--- D. Bolliger [EMAIL PROTECTED] wrote:
Derek B. Smith am Dienstag, 12. Dezember 2006 23:19:
I have a string like so:
/home/dbsmith/passwd.oftappp1.hpux and I need to
parse
out oftappp1 and hpux.
I have tried to use substr and and regexp with =~.
Here is what I have tried, but
line by line
processing...but I'm losing it in my (likely poorly constructed!)
reg-expression match
I do: -
#
# look for potentially problematic code of the following form: -
# STW b0, *SP--[3]
# The reg exp tries to match: -
# - anything up until 'ST' (so that we match STH, STW, STDW etc
Alan Campbell schreef:
Please don't top-post.
# look for potentially problematic dissassembly of the following
form: - # 8004b980 003c34f4 STW.D2T1 A0,*B15--[1]
my @dis_lines = ;
foreach my $ln (@dis_lines) {
if ($ln =~ m/.*ST[A-Z].*B15--.*[13579]]/) {
Alan Campbell wrote:
hello folks,
Hello,
Thanks for all the advice. As several of you suggested, the winning ticket
turned out to be flipping to line-by-line regex from an array-slurped
input i.e.
# look for potentially problematic dissassembly of the following form: -
# 8004b980
: -
# STW b0, *SP--[3]
# The reg exp tries to match: -
# - anything up until 'ST' (so that we match STH, STW, STDW etc) followed by
# - 1+ non-whitespace chars followed by
# - 0+ whitespace chars followed by
# - 0+ non-whitespace chars followed by
# the string 'B15--' followed by
# anything
]
# The reg exp tries to match: -
# - anything up until 'ST' (so that we match STH, STW, STDW etc) followed by
# - 1+ non-whitespace chars followed by
# - 0+ whitespace chars followed by
# - 0+ non-whitespace chars followed by
# the string 'B15--' followed by
# anything up until
or not, but it's something to
check.
-Original Message-
From: Alan Campbell [mailto:[EMAIL PROTECTED]
Sent: Friday, May 19, 2006 3:13 PM
To: beginners@perl.org
Subject: reg exp speed?
hello folks,
I'm slurping in a large file and seeing a nice speedup versus line by
line processing
of the following form: -
# STW b0, *SP--[3]
# The reg exp tries to match: -
# - anything up until 'ST' (so that we match STH, STW, STDW etc) followed by
# - 1+ non-whitespace chars followed by
# - 0+ whitespace chars followed by
# - 0+ non-whitespace chars followed by
# the string 'B15
]
# The reg exp tries to match: -
# - anything up until 'ST' (so that we match STH, STW, STDW etc)
followed by # - 1+ non-whitespace chars followed by
# - 0+ whitespace chars followed by
# - 0+ non-whitespace chars followed by
# the string 'B15--' followed by
# anything up
.
I'm open to using a module but pure reg exp (non line-by-line) seems
faster...and speed is important in this case due to filesize.
Grateful for any ideas u may have.
Cheers, Alan
Jay Savage [EMAIL PROTECTED] wrote:
On 4/29/06, Alan Campbell wrote:
hello folks,
I'm trying to do
/die which is too
muchkills stuff I need to keep. But .*? is too lazy...it doesnt handle the
nesting ie only kills up until the first /die.
To further complicate life, I cant guarentee the level of nesting.
Any ideas on how best to reg exp this? Or do I just need to improve/narrow
On 4/29/06, Alan Campbell [EMAIL PROTECTED] wrote:
hello folks,
I'm trying to do a 'medium' greediness regular expression. Here's what I
mean. I need to grab all of the DW_TAG_TI_reserved stuff and kill it (italics
below)
die id='0x157'
--
Hi,
The content of file hello.c is as given below.
I want to count how many + and - are there in this file.
I had equivalent shel command to count no. of + and -,
grep -e ^+[^+] diffs.txt | wc -l
grep -e ^-[^-] diffs.txt | wc -l
Can anyone help me how to write perl script using
On 4/27/06, sandy [EMAIL PROTECTED] wrote:
Hi,
The content of file hello.c is as given below.
I want to count how many + and - are there in this file.
I had equivalent shel command to count no. of + and -,
grep -e ^+[^+] diffs.txt | wc -l
grep -e ^-[^-] diffs.txt | wc -l
You say two
In the script I am writing, I use the following
regular expression:
$pass =~ tr/a-z/A-Z/s;
If I give the expression a string like Occ, then the
expression will convert it to OC instead of OCC!
What is going on?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
Christopher Spears wrote:
In the script I am writing, I use the following
regular expression:
$pass =~ tr/a-z/A-Z/s;
If I give the expression a string like Occ, then the
expression will convert it to OC instead of OCC!
What is going on?
the /s says to squash ( Programming Perl )
Christopher Spears wrote:
In the script I am writing, I use the following
regular expression:
$pass =~ tr/a-z/A-Z/s;
If I give the expression a string like Occ, then the
expression will convert it to OC instead of OCC!
What is going on?
tr/// does NOT use regular expressions, it
On Sep 14, Christopher Spears said:
In the script I am writing, I use the following
regular expression:
$pass =~ tr/a-z/A-Z/s;
If I give the expression a string like Occ, then the
expression will convert it to OC instead of OCC!
What is going on?
It sounds like you're using an operator you
Please respond to Subject
Jay Savage Re: reg exp using \G
[EMAIL PROTECTED
All,
I think I am on the right track as far as what assertion to use. I need to
print from one string to another using .. with \G
My goal is to capture from allsets down.
thank you
Here is my code:
#!/usr/bin/perl
use strict;
use warnings;
$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin);
open
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
I think I am on the right track as far as what assertion to use. I need to
print from one string to another using .. with \G
Why do you want to use \G?
My goal is to capture from allsets down.
Here is my code:
#!/usr/bin/perl
use
Subject
Re: reg exp using \G
Please respond to
Dave Gray
[EMAIL PROTECTED] am Dienstag, 2. August 2005 19.36:
reg exp using \G
Datum: 2.8.05 19:36:44
Von: [EMAIL PROTECTED]
An: beginners@perl.org
All,
I think I am on the right track as far as what assertion to use. I need to
print from one string to another using .. with \G
Your boss
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
technically you are correct about escaping the dot, but in this particular
situation my regexp is working. I will escape the dot.
my goal again is to print from one sting to another from allsets
down. I apologize for the long output
Subject
Re: reg exp using \G
Please respond to
Dave Gray
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
yes but the problem is my start point and end point have identical entries
under them. It is stopping at original1.1 when I need for it to stop at
the end of original1.1 and print
media: sf
Volumes:
STK000
Total space available:
On 8/2/05, Dave Gray [EMAIL PROTECTED] wrote:
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
yes but the problem is my start point and end point have identical entries
under them. It is stopping at original1.1 when I need for it to stop at
the end of original1.1 and print
media:
Please don't top post. I think you've been asked this before.
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
ok I understand now...thanks, but I tried it and it is still stopping at
original1.1
I then modified it to print YE if ($1) but never saw YE in STDOUT.
Tha's because
Can anyone help me with this match:
#!/usr/bin/perl
use strict;
use warnings;
my $talxkeylog =qq(/home/gpghrp/.gnupg/keys/log/talxkeyupd.log);
open (FH, +$talxkeylog) or warn unable to open file
$talxkeylog $!
;
#cURL();
#print $calcdate\n$curtdate;
my
Hello,
First of all you're opening the file for writing
Second i didn't understand what you really want , if you want to print out
everything inside the file
my $file = 'newfile.txt';
open(FILE,$file);
while(FILE){
print $_;}
close(FILE);
That's it with out matching or anything
bye
respond to Re: reg exp help
bright true
[EMAIL PROTECTED]
.com
On 6/28/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Can anyone help me with this match:
[snip]
for (;FH;)
{
if (/^-{5,}(\w+)/ig) {
print $_;
}
On Jun 28, [EMAIL PROTECTED] said:
for (;FH;) {
if (/^-{5,}(\w+)/ig) {
print $_;
}
$lc++;
}
I want to print everything from BEGIN TO END and right now all I am
printing is the begin and end lines.
If that's what you want, you should use two regexes with the .. operator:
while
1 - 100 of 208 matches
Mail list logo