Re: Less and regular expressions
- Date: Thu, 10 Jul 2008 18:59:43 +0200
- From: "Javier Barroso" <javibarroso@xxxxxxxxx>
- Subject: Re: Less and regular expressions
On Tue, Jul 8, 2008 at 9:20 PM, Bob Cox <debian-user@xxxxxxxxxxxxxxxx> wrote:
On Tue, Jul 08, 2008 at 11:37:11 -0700, Account for Debian group mail (debian@xxxxxxxx) wrote:Admittedly this does not answer your question (using 'less'), but this
>
> Hello,
>
> I'm doing a search of a syslog file using less - and having a brain fart.
>
> I'm trying to make a regular search _expression_ that will look for the word
> "greylist" and the word "*.aol.com" in the same line of the syslog.
>
> I just do not remember how to do this and looking around the Internet I'm
> not finding what I need.
>
> Can anyone help me?
should work:
grep greylist /var/log/syslog | grep 'aol\.com'
If you want context lines (-3 before and +4 later in the example you could use A and B switch):
grep -A4 -B3 "greylist.*\.aol\.com" /var/log/syslog | less
grep -A4 -B3 "greylist.*\.aol\.com" /var/log/syslog | less
--
Bob Cox. Stoke Gifford, near Bristol, UK.
Registered user #445000 with the Linux Counter - http://counter.li.org/
--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
- Follow-Ups:
- Re: Less and regular expressions
- From: Josh Miller
- Re: Less and regular expressions
- References:
- Less and regular expressions
- From: Account for Debian group mail
- Re: Less and regular expressions
- From: Bob Cox
- Less and regular expressions
- Prev by Date: Slow video
- Next by Date: Re: sudo password visible through ssh command line
- Previous by thread: Re: Less and regular expressions
- Next by thread: Re: Less and regular expressions
- Index(es):