Hi,
I'm trying to search a file for several matching blocks of text. A sample
of what I'm searching through is below.
What I want to do is match # START block # through to the next
# END block # and repeat that throughout the file without
matching any of the text that falls
On Thu, Nov 01, 2012 at 12:44:08AM -0700, Thomas Smith wrote:
Hi,
I'm trying to search a file for several matching blocks of text. A sample
of what I'm searching through is below.
What I want to do is match # START block # through to the next
# END block # and repeat that
On Nov 1, 2012, at 12:44 AM, Thomas Smith wrote:
Hi,
I'm trying to search a file for several matching blocks of text. A sample
of what I'm searching through is below.
What I want to do is match # START block # through to the next
# END block # and repeat that throughout
Good question. I went to a script right away after the difficulty with the
one-liner and returned to the command line syntax problem more out of curiosity
than anything else. I'm a fan of the command line because once I get one that
works all I need is the 'history' command and an up arrow
perl -i -p -e 's/^(\d{2}\t\d{2}\t\d{2})/g' This was the 1st thing that I
tried; it doesn't work. It was initially easy but different things kept
appearing that forced me to use 1
statements on the command line. Negating what I want seems like it ought to be
simple.
What have you
On 3/20/06, stu meacham [EMAIL PROTECTED] wrote:
perl -i -p -e 's/^(\d{2}\t\d{2}\t\d{2})/g' This was the 1st thing that I
tried; it doesn't work. It was initially easy but different things kept
appearing that forced me to use 1
statements on the command line. Negating what I want
I tried one final time with non-capturing parentheses i.e. (?: to no avail.
This works just fine however:
perl -i -p -e '@matches = m/\d{2}\t\d{2}\t\d{2}/g; s/.*//g; print@matches\n'
Retrieve, delete what's left, and rewrite what's to be kept. It should now
work everytime all the time.
:25 AM
To: Jay Savage; beginners perl
Subject: Re: regex one liner
I tried one final time with non-capturing parentheses i.e. (?: to no
avail.
This works just fine however:
perl -i -p -e '@matches = m/\d{2}\t\d{2}\t\d{2}/g; s/.*//g;
print@matches\n'
Retrieve, delete what's left, and rewrite
On 3/21/06, Timothy Johnson [EMAIL PROTECTED] wrote:
We run into one of these How do I do this in a one-liner? questions
pretty frequently, and I for one have to ask, what exactly makes the
one-liner so compelling, especially when you are using it for something
that will be run repeatedly?
Timothy Johnson wrote:
We run into one of these How do I do this in a one-liner? questions
pretty frequently, and I for one have to ask, what exactly makes the
one-liner so compelling, especially when you are using it for something
that will be run repeatedly?
Because you can use them in
-Original Message-
From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 21, 2006 1:36 PM
To: beginners perl
Subject: Re: regex one liner
Timothy Johnson wrote:
We run into one of these How do I do this in a one-liner? questions
pretty frequently, and I for one have
Timothy Johnson wrote:
And you can't do this?
alias pcalc='perl ~/pcalc.pl'
No. With alias, I can create an alias file that works with sh (and ksh,
bash) and csh (and tcsh). This would be dot'ed in your .profile as:
. ~/.alias
or source'd in your .cshrc as:
source ~/.alias
If
BTW, out here in the real world (that would be UNIX), *.pl stands for
Perl Library file, not a script.
What extension do you suggest using, if any, in the real world?
Thanks,
Kevin
--
Kevin Viel
Department of Genetics
On 3/21/06, Kevin Viel [EMAIL PROTECTED] wrote:
BTW, out here in the real world (that would be UNIX), *.pl stands for
Perl Library file, not a script.
What extension do you suggest using, if any, in the real world?
.ps for perl script
/snicker
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
perl
Subject: Re: regex one liner
Timothy Johnson wrote:
We run into one of these How do I do this in a one-liner? questions
pretty frequently, and I for one have to ask, what exactly makes the
one-liner so compelling, especially when you are using it for
something
-Original Message-
From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 21, 2006 2:29 PM
To: beginners perl
Subject: Re: regex one liner
Timothy Johnson wrote:
And you can't do this?
alias pcalc='perl ~/pcalc.pl'
No. With alias, I can create an alias file
-Original Message-
From: Jay Savage [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 21, 2006 3:06 PM
To: Timothy Johnson
Subject: Re: regex one liner
snip
And as for the issue of slightly varying regexes as arguments to a
script (different email), it may seem easier to you
:[EMAIL PROTECTED]
Sent: Tuesday, March 21, 2006 2:29 PM
To: beginners perl
Subject: Re: regex one liner
Timothy Johnson wrote:
And you can't do this?
alias pcalc='perl ~/pcalc.pl'
No. With alias, I can create an alias file that works with sh (and ksh,
bash) and csh (and tcsh
On Tue, Mar 21, 2006 at 09:27:28AM -0500, Jay Savage wrote:
On 3/20/06, stu meacham [EMAIL PROTECTED] wrote:
perl -i -p -e 's/^(\d{2}\t\d{2}\t\d{2})/g' This was the 1st thing that I
tried; it doesn't work. It was initially easy but different things kept
appearing that forced me to
On Tue, Mar 21, 2006 at 04:32:21PM -0700, Chad Perrin wrote:
misused the carat. Mea culpa, Jay. I didn't mean to lead you astray.
. . . and here I go with the stupid mistakes again. I meant Stu, not
Jay.
--
Chad Perrin [ CCD CopyWrite | http://ccd.apotheon.org ]
Real ugliness is not
On Tue, Mar 21, 2006 at 04:05:17PM -0700, Dave Gray wrote:
On 3/21/06, Kevin Viel [EMAIL PROTECTED] wrote:
BTW, out here in the real world (that would be UNIX), *.pl stands for
Perl Library file, not a script.
What extension do you suggest using, if any, in the real world?
.ps for
Timothy Johnson wrote:
Beyond being rude and immature, this is off-topic. Please don't try to
start a my OS is better than your OS war.
I wasn't trying to be rude but Perl was developed and evolved in UNIX;
something most people don't know. In UNIX, all scripts, whether there
are Perl, sh,
Chad Perrin wrote:
Actually, I tend to either use no file extension or .plx as the file
extension for a non-library script. I'm pretty sure ActivePerl
recognizes .plx (not entirely sure, but pretty sure), though I generally
do all my scripting on *nix, so it's not really an issue here.
In
I would like to modify a file 'in place' at the command line with regexes. The
file changes daily and is messy. Can one negate a regex itself as opposed to a
class of regular expressions? If I could remove everything but that selected
by m/\d{2}\t\d{2}\t\d{2}/g life would be better as I know
What have you tried? Have you seen the -i option?
-Original Message-
From: stu meacham [mailto:[EMAIL PROTECTED]
Sent: Monday, March 20, 2006 2:33 PM
To: beginners@perl.org
Subject: regex one liner
I would like to modify a file 'in place' at the command line with
regexes. The file
On 3/20/06, stu meacham [EMAIL PROTECTED] wrote:
I would like to modify a file 'in place' at the command line with regexes.
The file changes daily and is messy. Can one negate a regex itself as
opposed to a class of regular expressions? If I could remove everything but
that selected by
26 matches
Mail list logo