LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to grep *.info;mail.none;authpriv.none;cron.none; in /etc/syslog.conf (https://www.linuxquestions.org/questions/linux-server-73/how-to-grep-%2A-info%3Bmail-none%3Bauthpriv-none%3Bcron-none%3B-in-etc-syslog-conf-922463/)

sharadchhetri 01-06-2012 02:17 PM

How to grep *.info;mail.none;authpriv.none;cron.none; in /etc/syslog.conf
 
Hi,

I want to grep *.info;mail.none;authpriv.none;cron.none; this complete string in /etc/syslog.conf.
I tried with quotes and backslashes but nothing comes out.

Frnds,How to do this

Regards

corp769 01-06-2012 02:20 PM

Hello,

Doing the following, it works for me on my machine:
Code:

grep "*.info;mail.none;news.none;authpriv.none;cron.none" /etc/rsyslog.conf
You will just need to grep your syslog.cong file, as on my system, it is rsyslog.conf for me.

Cheers,

Josh

AlucardZero 01-06-2012 02:21 PM

Enclosing it in quotes works for me. Perhaps that EXACT string is not in the file?

Code:

u@h:~$ grep "*.info;mail.none;authpriv.none;cron.none" /etc/rsyslog.conf
*.info;mail.none;authpriv.none;cron.none                /var/log/messages


sharadchhetri 01-06-2012 02:34 PM

Quote:

Originally Posted by corp769 (Post 4568244)
Hello,

Doing the following, it works for me on my machine:
Code:

grep "*.info;mail.none;news.none;authpriv.none;cron.none" /etc/rsyslog.conf
You will just need to grep your syslog.cong file, as on my system, it is rsyslog.conf for me.

Cheers,

Josh


[root@server ~]# grep "*.info;mail.none;news.none;authpriv.none;cron.none" /etc/rsyslog.conf
[root@server ~]# echo $?
1
[root@server ~]#


It is not working,actually I have both files rsyslog and syslog both have same configuration settings for this.

I already tried which u have suggested.

corp769 01-06-2012 02:38 PM

I would cat both files and even see if that string exists within those files.

sharadchhetri 01-06-2012 02:39 PM

Quote:

Originally Posted by sharadchhetri (Post 4568257)
[root@server ~]# grep "*.info;mail.none;news.none;authpriv.none;cron.none" /etc/rsyslog.conf
[root@server ~]# echo $?
1
[root@server ~]#


It is not working,actually I have both files rsyslog and syslog both have same configuration settings for this.

I already tried which u have suggested.

Oops my bad.

[root@ip-118-139-160-169 ~]# grep "*.info;mail.none;authpriv.none;cron.none;" /etc/rsyslog.conf
[root@ip-118-139-160-169 ~]# echo $?
1
[root@ip-118-139-160-169 ~]#

Now it looks my question :) ,I copied ur content.
Here what I suspect because of ; , it is not working.


Amaze to see it is working in my some server.

I need some standard method. I checked with awk as well but it did nt work, I need this for my script.
What the hack is it. Ok I m checking now bash version and OS also.

corp769 01-06-2012 02:41 PM

Wait, what exactly are you trying to say? Did you get it to work?

sharadchhetri 01-06-2012 02:47 PM

Quote:

Originally Posted by sharadchhetri (Post 4568267)
Oops my bad.

[root@ip-118-139-160-169 ~]# grep "*.info;mail.none;authpriv.none;cron.none;" /etc/rsyslog.conf
[root@ip-118-139-160-169 ~]# echo $?
1
[root@ip-118-139-160-169 ~]#

Now it looks my question :) ,I copied ur content.
Here what I suspect because of ; , it is not working.


Amaze to see it is working in my some server.

I need some standard method. I checked with awk as well but it did nt work, I need this for my script.
What the hack is it. Ok I m checking now bash version and OS also.


bash-2.05b-41.7 -- It is working in this bash

bash-3.2-24.el5 -- not Working
bash-3.0-27.el4 -- not working

Need some same output from you guys.
let me know what is ur bash version. in 3.X package it has problem

corp769 01-06-2012 02:51 PM

Honestly, I use zsh. I did however try in bash, and it worked for me.
Code:

[root@ltp01 ~]# bash --version
GNU bash, version 4.2.10(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[root@ltp01 ~]# zsh --version
zsh 4.3.15 (x86_64-redhat-linux-gnu)
[root@ltp01 ~]#


sharadchhetri 01-06-2012 02:55 PM

hmm cannt say with 3.x version.
But anyhow any other method,I tried awk also not worked for me.


All times are GMT -5. The time now is 12:21 PM.