Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Newbie has a grep problem

    Hey forum,
    I have a question which is driving me crazy,
    I have a Apache web log file and I am trying to extract a string of text out of it . This is the piece of text i have copied from the log.

    I am trying to extract from ?hl to "; and print out the entries to a file

    /search?hl=en&q=frequently+used+unix+aliases&btnG=Google+Sea rch"; "Mozilla/4.0

    Should i be using a grep command to do this?

    Here is what I had been trying
    grep '\<?hl+eta\>' logs.txt

    any help is really great

    Many thanks


  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Is this what you want?
    egrep -o '\?hl.*\";' logs.txt
    On a related note, apachegrep might be of interest also:
    Manpage of apachegrep
    You must always face the curtain with a bow.

  3. #3
    Thanks a million Irithori, much appreciated it worked.

  4. $spacer_open

Posting Permissions

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