[CentOS] parsing out adjacent text

Tue Jun 3 16:10:18 UTC 2014
Bowie Bailey <Bowie_Bailey at BUC.com>

On 6/3/2014 11:55 AM, Tim Dunphy wrote:
> Ok this is what I came up with:
>
> #!/bin/bash
> # this script parses mod_status to see which hosts are getting the most
> requests
>
> while true
> do
> echo "Time and date: $(/bin/date +"%D %H:%M:%S")" >>
> /tmp/apache_request_log >> /tmp/apache_request_log
> echo “hostname: $(/bin/hostname -f)\n”   >> /tmp/apache_request_log
> echo “host ip: $(/bin/hostname -i)”   >> /tmp/apache_request_log
> echo "Server Stats: $(/usr/bin/GET `hostname -f`/server-status/?auto |
> /bin/egrep  -i 'kbytes')" >> /tmp/apache_request_log
> echo "Server Stats: $(/usr/bin/GET `hostname -f`/server-status/?auto |
> /bin/egrep  -i 'ReqPerSec')" >> /tmp/apache_request_log
> echo -e "\n"
> sleep 60
> done
>
> Still can't get the echo -e "\n" statement to print a new line for some
> reason. Other than that I'm good. And thanks for everyone's help!

'echo' on it's own should print a new line.  If you want two, why not 
just use two echo lines?

Also, you are piping everything else to the apache_request_log except 
for the last echo line.  Is the problem simply that you forgot to pipe 
that to the log file?

echo -e "\n" >> /tmp/apache_request_log

-- 
Bowie