Aengus ([EMAIL PROTECTED]):
> "Jeremy Wadsack" <[EMAIL PROTECTED]> wrote: >> Aengus ([EMAIL PROTECTED]): >> >> > I think your best bet will be to grep the logs for matching >> > requests. Does anyone know how to create a regular expression >> > to pick out lines with a field that is between 2 numerical values? >> >> You have to know the numbers. To get a field that is between 200 and >> 500 (inclusive) bytes, use something like this: >> >> [2345]00 > That will only find request for 200, 300, 400 or 500 bytes, it won't find > a request for 345 bytes (as far as I know - I still don't do regular > expressions!). Oops! You're right, of course. > Carsten is looking for kbytes, but the principal is the > same. > I suppose [2-5][0-9][0-9][0-9][0-9][0-9] find 200000 to 500000 > inclusive, but can you tell grep to only look at the nth field in a > file? > Maybe you need perl (or even sed) to do this? Perl or sed would be easier. You can't tell grep to look at the nth field. You might be able to use variables and cut, but that would get complicated. You could create a regular expression for grep if you knew the surrounding data well enough that you could define only one location in the file that the byte count could be found. Or you could define the whole log format with a regular expression as Stephen's anonlog does for some kinds of formats (common, combined and iis.). -- Jeremy Wadsack Wadsack-Allen Digital Group +------------------------------------------------------------------------ | This is the analog-help mailing list. To unsubscribe from this | mailing list, go to | http://lists.isite.net/listgate/analog-help/unsubscribe.html | | List archives are available at | http://www.mail-archive.com/[email protected]/ | http://lists.isite.net/listgate/analog-help/archives/ | http://www.tallylist.com/archives/index.cfm/mlist.7 +------------------------------------------------------------------------
