Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

silly awk question

Status
Not open for further replies.

ns705

Programmer
Feb 4, 2004
29
GB
Hi,

I'm very sorry for bothering you with such simple thing.
But it seems I could not find a way between three trees.

I have a variable which contains some text, I need to know the number of some chars in this text.
For ex., var="abc lalala new xyz new". I need to know the number of "new" chars in this variable.
Does any variable in awk exist which contain the number of matchs?

Thank you in advance.
Anta
 
Something like this ?
nbNew=gsub(/new/,"new",var)


Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank you!
Sure it's what I need.
I'm sorry I could not find it by myself.
Apparently, today is not my day.

Thank you a lot.

Anta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top