The UNIX and Linux Forums
>
Top Forums
>
UNIX for Dummies Questions & Answers
Pattern occurence in a file
User Name
Remember Me?
Password
Google UNIX.COM
Forums
Portal
Register
Rules & FAQ
Contribute
Members List
Arcade
Search
Today's Posts
Mark Forums Read
Thread
:
Pattern occurence in a file
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
#
5
(
permalink
)
12-09-2004
Ygor
Moderator
Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,226
in awk..
awk -v s="foo" '{r+=gsub(s,s)}END{print r}' file1
Ygor
View Public Profile
Find all posts by Ygor