Unix/Linux Forum: awk and grap - Unix/Linux Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

awk and grap Rate Topic: ***** 1 Votes

#1 User is offline   AmitG 

  • Newbie (User Level: 0/10)
  • Group: Members
  • Posts: 6
  • Joined: 21-January 09

Posted 21 January 2009 - 07:37 AM

Hi All,

============
ebit;9190000000;Hindi_Astrology_Cancer;Charging_Request;Astrology_Cancer;Karnata
ka;null;null;SUB;null;null;30;0;0;null;;0;genevasoftech_TWSS;null;Subscription Purchase;20090121113221;twss_F7C83CFEE0006F7;xyz;Hindi_Astrology_Cancer;null;SMS
;xyz;null;INR;Null;sms;53535;success;;
=============

i want to count [success] or multiple keyword in the same time.
=============================================
Thanks & Regards
------------------------------------------------------------------------
AMIT GUPTA
=============================================
0

#2 User is offline   eggi 

  • User Level: 6/10
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 311
  • Joined: 25-November 07
  • Location:Grayslake, IL USA

Posted 23 January 2009 - 02:43 AM

This should do it:

awk 'BEGIN{a=0}{ for (i=0;i < NF;i++) if ( $i ~ /success/ ) a++}END{print a}' YOURFILENAME

Best wishes,

Mike
The greatest viral marketing idea of all time, get your copy of this Free Report now!
----
Linux Tips, Trick and Advice -- The Linux and Unix Menagerie
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users