|
Posted by cyrusgreats on March 7, 2008, 5:19 pm
Please log in for more thread options > cyrusgre...@gmail.com wrote:
>
> )> Please post a short but complete program to show us what you are doing,
> )> as is suggested in the posting guidelines for this
group:http://www.rehabitation.com/clpmisc/clpmisc_guidelines.html
> )>
> )> --
> )> Gunnar Hjalmarsson
> )> Email:http://www.gunnar.cc/cgi-bin/contact.pl
> ) Well that depends of the question, the question is very straight
> ) forward, anyway here is portion of the code..again thanks..
> )
> ) my $cmd = "ps -eo pcpu,pid,user,args";
> ) my @output = '$cmd';
> ) foreach my $line (@output) {
> ) next if $line =~ /\s0.0/; # skip 0.0
> ) print $line, "\n";
> ) }
>
> First: The dot matches any character in a regexp.
> Second: I don't see the caret at the start of the regexp to anchor it.
> This will probably result in spurious matches.
> Third: The lines will already have newlines on them so the extra one
> in the print statement will produce blank lines.
>
> Oh, and fourth: in the original question, I *did* see the caret at the
> start, which made the question impossible to answer as such, let alone
> straight forward. This is one reason why the best way is to copy-paste
> the relevant bits of your code. All characters count.
>
> SaSW, Willem
> --
> Disclaimer: I am in no way responsible for any of the statements
> made in the above text. For all I know I might be
> drugged or something..
> No I'm not paranoid. You all think I'm paranoid, don't you !
> #EOT
ok, how about this, what if and only if I want to match anything but
not 0.0, since the above doesn't work..if the string as follows, I'm
interested in 0.2 not 0.0.
space 0.0 somewords
space 0.2 somewords
|