The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

displaying certain info from a log file

Discussion in 'General Discussion' started by abubin, Jul 27, 2005.

  1. abubin

    abubin Well-Known Member

    Joined:
    Dec 7, 2004
    Messages:
    393
    Likes Received:
    1
    Trophy Points:
    18
    Can I know how to display count of certain keyword in a log file?

    For eg, I want to count how many occurrence of the work "page1.html" on my http log file.

    Script will display :

    Page1.html occurred 1232 times

    I know it uses grep and tail but i am not expert enough to come up with the correct script.

    Thanks in advance.
     
  2. linux-image

    linux-image Well-Known Member

    Joined:
    Jun 8, 2004
    Messages:
    1,192
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    Root Administrator
    grep page1.html file | wc -l

    this has a problem that if 'page1.html' has occured more than once in a line, it will not be counted.
     
Loading...

Share This Page