Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    402
    Likes Received:
    3
    Trophy Points:
    168
    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,191
    Likes Received:
    1
    Trophy Points:
    168
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice