in reply to how to search for a string in large file?

perl -ne '$n += () = /foo/g }{ print $n' <(< large.txt fgrep foo)
Though this might not cover them all. Should "foof" match "foofoof" once or twice?

Replies are listed 'Best First'.
Re^2: how to search for a string in large file?
by littlemonk (Sexton) on Mar 18, 2014 at 18:55 UTC
    could please explain me the answer .. im new to perl!! :(