Sed Regular Expressions: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 52: | Line 52: | ||
Blank spaces (spaces, tabs, newlines): <tt>\s</tt> does not seem to work. | Blank spaces (spaces, tabs, newlines): <tt>\s</tt> does not seem to work. | ||
=Regular Expression Syntax= |
Revision as of 22:33, 29 July 2017
Internal
Special Characters (need to be escaped in regular expressions)
/ " $ # unescaped signifies end of line ! [ ]
Non-Special Characters (do not need to be escaped in regular expressions)
< > ( ) ! -
Grouping
Use \( and \) for grouping. Parentheses must be escaped to be interpreted as grouping separator.
Examples
Match everything except space:
[^ ]*
.*
seems to work too.
Words (digits, alpha, _):
sed -e 's/[0-9a-zA-Z_]*/THIS_WAS_A_WORD/g'
Blank spaces (spaces, tabs, newlines): \s does not seem to work.