Le Sat, Jan 05, 2002 at 08:51:19AM +0800, Leon a dit le suivant:
}
} > If so, I suggest something like:
} > $text =~ s/.*?//gs;
}
} * means zero or more instances;
} ? means zero or one instances;
} + means one or more instances;
}
} so what is the meaning of .*?
.. matches any type of input
#!/usr/bin/perl -i
while (<>) {
/\n/g;;
print $_;
}
--
Namaste,
Kristin
"The universe seems neither benign nor hostile, merely indifferent."
- Carl Sagan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
> perl -ni -e 'next unless /foo/' myfile.txt
Actually, finally got this to work this way to remove all lines but those containing
foo:
perl -ni -e 'next unless /foo/; print;' myfile.txt
and this way for all those not containing foo:
perl -ni -e 'next if /foo/; print;' myfile.txt
--
Na
Tested these in order to learn how they work, and the first one simply deleted the
entire contents my test file which was peppered with foo on multiple (but not all)
lines
- Forwarded message from Bob Showalter <[EMAIL PROTECTED]> -
Second, the canonical one-liner to delete lines f
*- chucking in my extreme newbie's 2-cents'-worth -*
Has anyone out there noticed that,
when shopping at almost any of the huge
book conglomerates,
Perl is almost never shelved with the rest
of the programming languages,
but instead with Javascript and HTML in
the "Web" section?
--
Namaste,
Kr
I don't know if this will help at all, but I just found out, myself,
about the -s option.
If you run your script with:
#!/usr/bin/perl -s
and remember, to keep strict happy, to:
use vars qw($all_the $variables $you_need $from_stdin);
You can run your script like this:
bash-2.03$ script.pl -varia
I have used join in order to make one big line of a document for searches such as the
one you suggest. Also, in another script I did this:
open(FILE,"$_");
my $txt = "";
$searchfile = $_;
while () {$txt .= $_;}
close(FILE);
## Search $txt for $string; if it is found, write the name