Sending zip file containing plain txt file via email

13,352

To wrap the text file you can use fold (see fold man page)

For example

fold -w 78 -s input.txt > wrapped.txt

will wrap your text to a maximum width of 78 characters. You can then use zip to compress it

zip wrapped.zip wrapped.txt 

and then send it per email with mail

mail -a wrapped.zip -s "Subject of the mail" [email protected]

(not all versions of mail support the -a option)

Share:
13,352

Related videos on Youtube

anonymous
Author by

anonymous

Updated on September 18, 2022

Comments

  • anonymous
    anonymous over 1 year

    How to send a plain txt file in a zip file via email in unix? The contents in the txt file should be word wrap.

    • Matteo
      Matteo about 10 years
      Why the down vote?
    • Anthon
      Anthon about 10 years
      These are multiple questions: 1) how to word wrap a text file; 2) how to zip a plain txt file; 3) how to email a zip file as an attachment. What exactly have you tried for each and what is not working?
    • Anthon
      Anthon about 10 years
      @Matteo If you hover above the down vote arrow it says "This question does not show any research effort", I think that is applicable on each of the 3 questions asked.