Thanks - that was exactly what I was looking for.

Now I just need to find a good scripting tutorial.  :)

-----Original Message-----
From: Michael Marsh [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 21, 2007 8:38 AM
To: debian-user@lists.debian.org
Subject: Re: scripting question

On 9/21/07, Michael Martinell <[EMAIL PROTECTED]> wrote:
> I have a simple script that counts up the number of spam messages each day
> and prints the total number into a text field.  This is fine as far as it
> goes, however I would like to also include the date and the number of
> non-spam messages.
>
> I can get this to run, however each piece of information is printed on
it's
> own line.  I would like to have all of the results append in my text file
on
> the same line so that I can easily import it into a spreadsheet or
database.
>
> How would I go about doing this?
>
> My script is as follows:
...
> date && echo " Spam Count" && /bin/more /var/log/syslog | /bin/grep -c
> 'identified spam' && echo " " && echo "Clean Message Count " &&  /bin/more
> /var/log/syslog | /bin/grep -c 'clean message'

You can concatenate things in a single echo simply by passing multiple
arguments.  Slinging a few backticks, and you can do something like:

echo `date` " dollar signs: " `grep -c \$ ~/.bashrc` " comments: "
`grep -c \# ~/.bashrc`

Put the file name in a variable, and it should be even simpler.

-- 
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com
http://36pints.blogspot.com


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact
[EMAIL PROTECTED]



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to