Полезная информация

sed & awk

sed & awkSearch this book
Previous: 3.2 A Line-Up of CharactersChapter 3
Understanding Regular Expression Syntax
Next: 4. Writing sed Scripts

3.3 I Never Metacharacter I Didn't Like

Table 3.4 lists interesting examples of regular expressions, many of which have been described in this chapter.

Table 3.4: Useful Regular Expressions
ItemRegular Expression
Postal Abbreviation for State [A-Z][A-Z]
City, State^.*, [A-Z][A-Z]
City, State, Zip (POSIX egrep)^.*, [A-Z][A-Z] [0-9]{5}(-[0-9]{4})?
Month, Day, Year[A-Z][a-z]\{3,9\} [0-9]\{1,2\}, [0-9]\{4\}
U.S. Social Security Number[0-9]\{3\}-[0-9]\{2\}-[0-9]\{4\}
North-American Local Telephone[0-9]\{3\}-[0-9]\{4\}
Formatted Dollar Amounts\$[ 0-9]*\.[0-9][0-9]
troff In-line Font Requests\\f[(BIRP]C*[BW]*
troff Requests^\.[a-z]\{2\}
troff Macros^\.[A-Z12].
troff Macro with arguments^\.[A-Z12]. ".*"
HTML In-line Codes<[^>]*>
Ventura Publisher Style Codes^@.* = .*
Match blank lines^$
Match entire line^.*$
Match one or more spaces  *

Previous: 3.2 A Line-Up of Characterssed & awkNext: 4. Writing sed Scripts
3.2 A Line-Up of CharactersBook Index4. Writing sed Scripts

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System