perl regexp problem 2

I have a list of command to parse...

like:

> ls -lart 
> ls 
> ls /etc/passwd 
> ping 
> ping 127.0.0.1
> PING
> LS

I have to count the number of times ls and ping was executed, I have to not count uppercase variant like LS and PING, but I have to count command launch with option like "ls -lart"

How to check if a line contain the exact word ls or ping or whatever?

With regular expression!!!

Thanks,

Answers


my $count = 0;

while (<STDIN>) {
  m/^\s*(ls|ping).*$/;
  $count++ if $1;
}

Need Your Help

HTTP Error 403: Forbidden w/ User Agents Added

python http web web-scraping http-status-code-403

Usually I've been able to get around 403 Errors once I've added a known User Agent but I'm now trying to login and then eventually scrape and cannot figure out how to bypass this error.

Are all css animations that come in from the right bugged?

jquery css css-animations

I wish to have a design in which three elements are supposed to come into view via different css animations whenever the user scrolls over them: one from the top, one from the left, and one from the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.