From: Toby Cubitt <tsc25@cantab.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Potential Supid question re Grep
Date: Sat, 9 Jul 2005 01:30:33 +0200 [thread overview]
Message-ID: <20050708233031.GB9837@r2d2.localdomain> (raw)
In-Reply-To: <200507071918.27760.mike@thompsonmike.co.uk>
On Thu, Jul 07, 2005 at 07:18:26PM +0100, Michael Thompson wrote:
> I am trying to extract information in my logs for a abuse department and am
> using the code:
>
> Code:
>
> zcat /var/log/messages.*?.gz | grep 212.56.68.108 >> /home/mike/abuse1
>
> The logs are standard: messages.??.gz
>
> However, when I examine the output, it starts on the 1st may, however the logs
> contain details from the 25th Febuary. What am I doing wrong?
This isn't the cause of your problem (which has probably been solved by some
of the other posts), but don't forget that grep matches regexps, not strings,
and "." in a regexp matches any single character. Therefore your code will match
"212a56b68c108" (for example), as well as the ip you probably intended to match.
To make sure you only match the ip, you'll need to escape the .s and surround
the regexp by quotes:
grep '212\.56\.68\.108'
I'm probably telling you things you already know ;-) And it probably won't
matter much anyway, but I thought I'd mention it in case it helps someone.
Toby
--
Quantum Information Theory group
Max Planck Institute for Quantum Optics
Garching, Germany
email: toby@dr-qubit.org
web: www.dr-qubit.org
--
gentoo-user@gentoo.org mailing list
prev parent reply other threads:[~2005-07-08 23:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-07 18:18 [gentoo-user] Potential Supid question re Grep Michael Thompson
2005-07-07 18:32 ` A. Khattri
2005-07-07 18:47 ` Michael Thompson
2005-07-07 19:19 ` A. Khattri
2005-07-07 22:54 ` Richard Fish
2005-07-08 2:04 ` Nick Rout
2005-07-08 23:30 ` Toby Cubitt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050708233031.GB9837@r2d2.localdomain \
--to=tsc25@cantab.net \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox