Removing spaces from /etc/syslog.conf
I ran into a problem today with spaces in /etc/syslog.conf. Any spaces between the selectors and actions upset the m4 parser -- you've got to use tabs.
I'm using a deployment / provisioning tool (not xVM) that wants to put spaces in that file. Very frustrating.
Here's a one-liner Perl script that strips out the spaces and replaces them with tabs. The file will look a little ugly, but at least it'll work.
# perl -pi'*.bak' -e 's/^(\S+?\.\S+)\s*(\S*)/$1\t\t$2/' /etc/syslog.conf
There are a hundred ways to skin this cat, but this was quick and only one line, which is what I needed.
Enjoy.