- 论坛徽章:
- 0
|
看看man tr不就清楚了:
tr -cs '[:alpha:]' '[\n*]'
把非字母的符号全部变为\n(换行),然后再压缩\n(连续的\n变成一个)
黑哥也忙,有问题先man 一下嘛,不理解再问黑哥
SYNOPSIS
tr [OPTION]... SET1 [SET2]
DESCRIPTION
Translate, squeeze, and/or delete characters from standard input, writing to standard output.
-c, -C, --complement
first complement SET1
-s, --squeeze-repeats
replace each input sequence of a repeated character that is listed in SET1 with a single occur-
rence of that character
SETs are specified as strings of characters. Most represent themselves. Interpreted sequences are:
\NNN character with octal value NNN (1 to 3 octal digits)
\\ backslash
\a audible BEL
\b backspace
\f form feed
\n new line
[CHAR*]
in SET2, copies of CHAR until length of SET1
[ 本帖最后由 dream3401 于 2009-3-24 15:59 编辑 ] |
|