Chapter 3. Regular Expressions(正则表达式)
20. Regular Expression Fundamentals(正则表达式基础)
- Beginning of line (
^
) - End of line (
$
) - Single Character (.)
- Zero or more Occurrences (
*
) - One or more Occurrence (
\+
) - Zero or one Occurrence (
\?
) - Escaping the Special Character (
\
) - Character Class (
[0-9]
)21. Additional Regular Expressions (扩展正则表达式)
- OR Operation (
|
) - Exactly M Occurrences (
{m}
) - M to N Occurrences (
{m,n}
) - Word Boundary (
\b
)(单词边界符) - Back References (
\n
)(反向引用,n
为数字)22. Sed Substitution Using Regular Expression
Convert the DOS file format to Unix file format using sed:
使用sed
将DOS下的新行换行符(CR/LF)替换成Unix下的格式1sed 's/.$//' filename