| 1 | #! /bin/sh |
| 2 | # Strips off the header from a mail/News message i.e. till the first |
| 3 | #+ empty line. |
| 4 | # Author: Mark Moraes, University of Toronto |
| 5 | |
| 6 | # ==> These comments added by author of this document. |
| 7 | |
| 8 | if [ $# -eq 0 ]; then |
| 9 | # ==> If no command-line args present, then works on file redirected to stdin. |
| 10 | sed -e '1,/^$/d' -e '/^[ ]*$/d' |
| 11 | # --> Delete empty lines and all lines until |
| 12 | # --> first one beginning with white space. |
| 13 | else |
| 14 | # ==> If command-line args present, then work on files named. |
| 15 | for i do |
| 16 | sed -e '1,/^$/d' -e '/^[ ]*$/d' $i |
| 17 | # --> Ditto, as above. |
| 18 | done |
| 19 | fi |
| 20 | |
| 21 | exit |
| 22 | |
| 23 | # ==> Exercise: Add error checking and other options. |
| 24 | # ==> |
| 25 | # ==> Note that the small sed script repeats, except for the arg passed. |
| 26 | # ==> Does it make sense to embed it in a function? Why or why not? |
| 27 | |
| 28 | |
| 29 | /* |
| 30 | * Copyright University of Toronto 1988, 1989. |
| 31 | * Written by Mark Moraes |
| 32 | * |
| 33 | * Permission is granted to anyone to use this software for any purpose on |
| 34 | * any computer system, and to alter it and redistribute it freely, subject |
| 35 | * to the following restrictions: |
| 36 | * |
| 37 | * 1. The author and the University of Toronto are not responsible |
| 38 | * for the consequences of use of this software, no matter how awful, |
| 39 | * even if they arise from flaws in it. |
| 40 | * |
| 41 | * 2. The origin of this software must not be misrepresented, either by |
| 42 | * explicit claim or by omission. Since few users ever read sources, |
| 43 | * credits must appear in the documentation. |
| 44 | * |
| 45 | * 3. Altered versions must be plainly marked as such, and must not be |
| 46 | * misrepresented as being the original software. Since few users |
| 47 | * ever read sources, credits must appear in the documentation. |
| 48 | * |
| 49 | * 4. This notice may not be removed or altered. |
| 50 | */ |