Can anyone convert this from sed to perl:
sed -n '/\var\/log/p' /etc/syslog.conf
I think Ive looked at this to much....urgh..
Thanks
Ben
Can anyone convert this from sed to perl:
sed -n '/\var\/log/p' /etc/syslog.conf
I think Ive looked at this to much....urgh..
Thanks
Ben
Did you meant to convert
sed -n '/\/var\/log/p' /etc/syslog.conf
Im sorry I dont understand what your asking. I need to convert it from sed to a perl command.
Thanks
Ben
Try this,
perl -nle "print if(/\/var\/log/)" /etc/syslog.conf
In your code you are trying to print /var/log.
But in your first post you didn't escape the slash properly.
That is the question from Mr.devtakh
What your sed is doing is printing all the lines which has /var/log in it (emulates "grep").
Now to do same easiest way is
perl -nle 'print if /pattern/' file(s)
so kind of one liner in perl.
$ perl -nle 'print if /\var\/log/' /etc/syslog.conf