easy shell scripting question

Posted on 2006-03-31
Last Modified: 2010-04-17
I've made with the help of people here this script to filter the ssh attempts:

cat /var/log/messages | grep "authentication failure;" | gawk -F: '{ print $4 }' > /tmp/ssh.txt
sort /tmp/ssh.txt | uniq > /tmp/sshfinal.txt
cat /tmp/sshfinal.txt | gawk -F"rhost=" '{ split($2, a, " |\r\n"); print a[1]; }' | uniq > /tmp/sshfinal.txt

i've added this line to get it via email after a cron setup.

echo -e "Subject:Firewall\nFrom:Server <senderemail\>\n"`cat /tmp/sshfinal.txt` | /usr/sbin/sendmail myemail

The sshfinal.txt file looks like this:

But ofcourse when I receive the email its like this :

it may sounds stupid but how can I change that ?

I know i could do that if i would use \n at the end of each ip in the sshfinal.txt file, but the file is generated by the script each time so I dont know how to do that.

Question by:MaRiOsGR
    LVL 84

    Accepted Solution

    (echo -e "Subject:Firewall\nFrom:Server <senderemail\>\n"; cat /tmp/sshfinal.txt) | /usr/sbin/sendmail myemail
    LVL 2

    Author Comment

    it was so easy? damn..

    thank you veru much.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now