菜鸟求助
- xiehuoli
- 帖子: 5941
- 注册时间: 2006-06-10 8:43
- 来自: 中国 CS
- xiehuoli
- 帖子: 5941
- 注册时间: 2006-06-10 8:43
- 来自: 中国 CS
- xiehuoli
- 帖子: 5941
- 注册时间: 2006-06-10 8:43
- 来自: 中国 CS
-
- 帖子: 849
- 注册时间: 2006-09-07 22:51
- 联系:
- 5451vs5451
- 帖子: 345
- 注册时间: 2006-07-14 18:56
- 来自: Apple Valley, Planet Tux, Linux System
-
- 帖子: 44
- 注册时间: 2007-04-29 13:15
#! /bin/sh
# Strips off the header from a mail/News message i.e. till the first
# empty line
# Mark Moraes, University of Toronto
# ==> These comments added by author of this document.
if [ $# -eq 0 ]; then
# ==> If no command line args present, then works on file redirected to stdin.
sed -e '1,/^$/d' -e '/^[ ]*$/d'
# --> Delete empty lines and all lines until
# --> first one beginning with white space.
else
# ==> If command line args present, then work on files named.
for i do
sed -e '1,/^$/d' -e '/^[ ]*$/d' $i
# --> Ditto, as above.
done
fi
# ==> Exercise: Add error checking and other options.
# ==>
# ==> Note that the small sed script repeats, except for the arg passed.
# ==> Does it make sense to embed it in a function? Why or why not?
请好心人解析一下sed的那两行
# Strips off the header from a mail/News message i.e. till the first
# empty line
# Mark Moraes, University of Toronto
# ==> These comments added by author of this document.
if [ $# -eq 0 ]; then
# ==> If no command line args present, then works on file redirected to stdin.
sed -e '1,/^$/d' -e '/^[ ]*$/d'
# --> Delete empty lines and all lines until
# --> first one beginning with white space.
else
# ==> If command line args present, then work on files named.
for i do
sed -e '1,/^$/d' -e '/^[ ]*$/d' $i
# --> Ditto, as above.
done
fi
# ==> Exercise: Add error checking and other options.
# ==>
# ==> Note that the small sed script repeats, except for the arg passed.
# ==> Does it make sense to embed it in a function? Why or why not?
请好心人解析一下sed的那两行
-
- 帖子: 119
- 注册时间: 2007-04-09 12:19