Koozali.org: home of the SME Server

grep headache

Offline ReetP

  • *
  • 3,722
  • +5/-0
grep headache
« on: July 19, 2018, 05:17:16 PM »
Doing my head in with this with AWStats

I have some strings in a log.

/index.php?main_page=product_info&products_id=3301

/index.php?main_page=product_info&cPath=33&products_id=3188

The string can vary a little but the defining match is:

product_id=some.number

I tried this and a load of variations that all failed :-(

^\/.*\&products_id=(\d+)


Any suggestions on a grep pattern to match this?
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline holck

  • ****
  • 317
  • +1/-0
Re: grep headache
« Reply #1 on: July 19, 2018, 09:03:22 PM »
Here is a suggestion:
Code: [Select]
egrep "^/.*\&products_id=[0123456789]+"

Doing my head in with this with AWStats

I have some strings in a log.

/index.php?main_page=product_info&products_id=3301

/index.php?main_page=product_info&cPath=33&products_id=3188

The string can vary a little but the defining match is:

product_id=some.number

I tried this and a load of variations that all failed :-(

^\/.*\&products_id=(\d+)


Any suggestions on a grep pattern to match this?
......

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: grep headache
« Reply #2 on: July 19, 2018, 09:27:59 PM »
Ah cool thanks.

I'll give it a whirl and let you know !!
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation