Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] GREP basics



On Thu, 30 Jan 2003, Viktor Pavlenko wrote:

>> What if there's more than one occurance of <hdwh> on the same line?
>
>perl -ne '$m += split /<hdwd>/; --$m; END {print "$m\n"}' *

Hm, my perl is a bit rusty, does this count the occurrances if they
start within the previous occurrance? So that if you want to count the
occurrances of the string "aba" in the string "ababa" so it would answer
two?

-- 
Tapio Peltonen <tappel@example.com>

This novel is not to be tossed lightly aside, but to be hurled with
great force.
                -- Dorothy Parker



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links