[EMAIL PROTECTED] wrote:
Hi,
Hello,
I am trying to use a regular expression to search for some words in a
file after a few particular
words/characters.
Once I find the words I am looking for, I want to print only those
words.
Here's what I'm talking about.
while(<INPUT>) {
if (/Something\s>\s(\w+)/) {
print "1$".
}
I realize that this will only print one word after '>\s' (i.e. $1).
However, what if there are a variable number of words after '>\s' ?
How would I print all the words and only the words that come after
'>s' ?
$ perl -le'
$_ = " word0 Something > word1 word2 word3 ";
$, = " - ";
/Something\s>\s/g && print /\w+/g;
'
word1 - word2 - word3
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/