Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-07-2002, 04:10 PM   #1
Registered: Jun 2001
Distribution: FC4
Posts: 136

Rep: Reputation: 15
How do I zip and attach the output data of a grep | awk | mail shell script?

I need the output data of the following shell script to be zipped up and mail as an attachement for a Windows recipient. What can I do?

grep "^From *" abuse.axis | awk '{print $2}' | mail -s “Abuse Complaints “

Old 05-08-2002, 08:26 AM   #2
Senior Member
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
As far as I know the mail command can just handle simple text. So you might want to try using a mailing program which does support attachments.

If however you are stuck on using the mail command then you'll have to add the attachment as a MIME part. I'm not sure on the complete syntax for that you'll probably have to look that up. But you could zip the output using gzip and then use the tool uuencode to change it to ASCII data. Then insert it into the mail along with the extension header. Winzip should read gzip files without any problems but if you want it to be a windows zip file then you'll have to use a utility for linux which creates pkzip files.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script question (grep and awk) hamish Linux - Software 6 04-06-2005 03:14 PM
Passing variables from AWK script to my shell script BigLarry Programming 1 06-12-2004 04:32 AM
How to run a shell command containing awk, and grep within a C program Linh Programming 3 06-05-2003 07:05 PM
Running a shell command containing awk and grep within a C program Linh Programming 1 06-05-2003 06:51 PM
Awk and Shell CMD Output xanthium Programming 16 04-24-2002 06:13 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration