- 论坛徽章:
- 5
|
回复 5# 灿烂小猪
把所有大写字母变成小写。就这一个l=lowercase
用info sed命令,第3.5章节s替换参数里有详细介绍- 3.5 The `s' Command
- ===================
- The syntax of the `s' (as in substitute) command is
- `s/REGEXP/REPLACEMENT/FLAGS'. The `/' characters may be uniformly
- replaced by any other single character within any given `s' command.
- The `/' character (or whatever other character is used in its stead)
- can appear in the REGEXP or REPLACEMENT only if it is preceded by a `\'
- character.
- The `s' command is probably the most important in `sed' and has a
- lot of different options. Its basic concept is simple: the `s' command
- attempts to match the pattern space against the supplied REGEXP; if the
- match is successful, then that portion of the pattern space which was
- matched is replaced with REPLACEMENT.
- The REPLACEMENT can contain `\N' (N being a number from 1 to 9,
- inclusive) references, which refer to the portion of the match which is
- contained between the Nth `\(' and its matching `\)'. Also, the
- REPLACEMENT can contain unescaped `&' characters which reference the
- whole matched portion of the pattern space. Finally, as a GNU `sed'
- extension, you can include a special sequence made of a backslash and
- one of the letters `L', `l', `U', `u', or `E'. The meaning is as
- follows:
- `\L'
- Turn the replacement to lowercase until a `\U' or `\E' is found,
- `\l'
- Turn the next character to lowercase,
- `\U'
- Turn the replacement to uppercase until a `\L' or `\E' is found,
- `\u'
- Turn the next character to uppercase,
- `\E'
- Stop case conversion started by `\L' or `\U'.
复制代码 |
|