Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Unanswered: Bash String Stuff

    I have this string:

    Hello my name is bubba, I like to dip alot my name is bubba.

    Here is the simple question, How do I count how many times "bubba" appeared in the string?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2004
    Location
    Bordeaux, France
    Posts
    320
    a solution among so much of others

    string="Hello my name is bubba, I like to dip alot my name is bubba."
    echo $string | awk '{print gsub(/bubba/,"")}'
    Jean-Pierre.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •