• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

easy shell scripting question

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.

1 Solution
(echo -e "Subject:Firewall\nFrom:Server <senderemail\>\n"; cat /tmp/sshfinal.txt) | /usr/sbin/sendmail myemail
MaRiOsGRAuthor Commented:
it was so easy? damn..

thank you veru much.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now