|
|
|
|
||||||
| linux.debian.user debian-user@lists.debian.org. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 me? Thanks, Ken -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 On 07/08/08 13:37, Account for Debian group mail wrote: > 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. This might point you in the right direction: $ cat /var/log/dmesg | perl -ne 'print if /usb/ && /low/' usb 1-9: new low speed USB device using ohci_hcd and address 2 usb 1-9: new low speed USB device using ohci_hcd and address 3 - -- Ron Johnson, Jr. Jefferson LA USA "Kittens give Morbo gas. In lighter news, the city of New New York is doomed." -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkhzuSgACgkQS9HxQb37Xmc6zQCgoNdKBORhfB 3Q0uGjPzkChNQV 0GoAn3kFU2G3I/lq7v2G8zUbmwTjvWsQ =BwxH -----END PGP SIGNATURE----- -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Tue, Jul 08, 2008 at 11:37:11 -0700, Account for Debian group mail (debian@pcez.com) wrote:
> > 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 me? Admittedly this does not answer your question (using 'less'), but this should work: grep greylist /var/log/syslog | grep 'aol\.com' -- 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@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Account for Debian group mail wrote:
> 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 me? > > Thanks, > > Ken > > That depends ![]() Are you just looking for 'a' followed by 'b', or might you want to see that and 'b' followed by 'a'? Is the '*' in '*.aol.com' literal? And do you want to find only cases where both words happen, or are you also interested in lines with one or the other, alone? The simple case ('a' followed by 'b', no specific regex characters to take literally) would be to just say: greylis.*aol\.com Hope this s If you need a more complex search, I'll can take asecond (longer) look. -- Bob McGowan |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
> 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. Do a Google search for "sed one liners"; I use that /ALL/ the time cause I never remember all of the cool things sed can do. Anyway, specifically there is a part that states: # grep for AAA and BBB and CCC (in any order) sed '/AAA/!d; /BBB/!d; /CCC/!d' # grep for AAA and BBB and CCC (in that order) sed '/AAA.*BBB.*CCC/!d' So for you, I would suggest: sed '/greylist/!d; /.aol.com/!d;' /path/to/syslog Have fun! ~Stack~ -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On Tue, Jul 8, 2008 at 9:20 PM, Bob Cox <debian-user@lists.bobcox.com>
wrote: > On Tue, Jul 08, 2008 at 11:37:11 -0700, Account for Debian group mail ( > debian@pcez.com) wrote: > > > > > 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 me? > > Admittedly this does not answer your question (using 'less'), but this > 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 > > > -- > 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@lists.debian.org > with a subject of "unsubscribe". Trouble? Contact > listmaster@lists.debian.org > > |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
> On Tue, Jul 8, 2008 at 9:20 PM, Bob Cox <debian-user@lists.bobcox.com>
> wrote: > >> On Tue, Jul 08, 2008 at 11:37:11 -0700, Account for Debian group mail ( >> debian@pcez.com) wrote: >> >> > >> > 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 me? less +/'greylist.*\*.aol.com' <file> -- Josh Miller, RHCE -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
![]() |
| Outils de la discussion | |
|
|