4 ¹ø ±Û: [GNU sed] ¸ÞŸ ¹®ÀÚ¿Í ±×·ìÈ |
±Û¾´ÀÌ: »êÀÌ
[ȨÆäÀÌÁö]
|
±Û¾´³¯: 2003³â 01¿ù 09ÀÏ 00:13:01 ¸ñ(»õº®) |
Á¶È¸: 4250 |
´Ù¸¥ Á¤±ÔÇ¥Çö½Ä°ú »ó´çÈ÷ Çò°¥¸®´Â sed
(ÀÚÁÖ Àؾî¸ÔÀ½)
¿¹)
$ echo 'abc(def)g' | sed 's/^\([^(]\+\)(\([^)]\+\))/\1_\2_/g'
abc_def_g
's/^\([^(]\+\)(\([^)]\+\))/\1_\2_/g'
^^^^^^^^^^ ^^^^^^^^^^
abc ( def )
\1 \2
¸ÞŸ¹®ÀÚ¸¦ ±¸·ìÈÇÒ °æ¿ì Å»Ãâ(\) ¹®ÀÚÃß°¡
(´Ù¸¥ Á¤±ÔÇ¥Çö½Ä°ú ´Ù¸¥Á¡)
+ -> \+ -> ¹®ÀÚ ÁýÇÕ([class])¿¡ ´ëÇÑ Çϳª ÀÌ»ó
() -> \(\) -> ±×·ìÈ¿¡ »ç¿ë -> \1, \2, \3, ... \9
{} -> \{\} -> ¹Ýº¹¹üÀ§ ÁöÁ¤
| -> \| -> or ¿¬»ê
-----------------------
^ -> ¸ÞŸ¹®ÀÚ, ¶óÀÎÀÇ ½ÃÀÛ
$ -> ¸ÞŸ¹®ÀÚ, ¶óÀÎÀÇ ³¡
[] -> ¸ÞŸ¹®ÀÚ, ¾î¶² ¹®ÀÚµéÀÇ ÁýÇÕ, ¸ÞŸ¹®ÀÚ·Î ÀνÄ
\ -> ¸ÞŸ¹®ÀÚ, ¸ÞŸ¹®ÀÚ¸¦ Å»Ãâ
* -> ¸ÞŸ¹®ÀÚ, ¹®ÀÚ ÁýÇÕ¿¡ ´ëÇÑ 0 ÀÌ»ó /*** ÁÖÀÇ ***/
. -> ¸ÞŸ¹®ÀÚ, ¾î¶² ¹®ÀÚµçÁö ¸ÅĪ
() -> '('¿Í ')' ¹®ÀÚ, ¸ÞŸ¹®ÀÚ·Î ÀνÄÇÏÁö ¾ÊÀ½
? -> '?' ¹®ÀÚ, ¸ÞŸ¹®ÀÚ·Î ÀνÄÇÏÁö ¾ÊÀ½
\` - matches the beginning of the pattern space (same as "^")
\' - matches the end of the pattern space (same as "$")
\? - 0 or 1 occurrences of previous character: same as \{0,1\}
\+ - 1 or more occurrences of previous character: same as \{1,\}
\| - matches the string on either side, e.g., foo\|bar
\b - boundary between word and nonword chars (reversible)
\B - boundary between 2 word or between 2 nonword chars
\n - embedded newline (usable after N, G, or similar commands)
\w - any word character: [A-Za-z0-9_]
\W - any nonword char: [^A-Za-z0-9_]
\< - boundary between nonword and word character
\> - boundary between word and nonword character
[[:alnum:]] -> [A-Za-z0-9] Alphanumeric characters
[[:alpha:]] -> [A-Za-z] Alphabetic characters
[[:blank:]] -> [ \x09] Space or tab characters only
[[:cntrl:]] -> [\x00-\x19\x7F] Control characters
[[:digit:]] -> [0-9] Numeric characters
[[:graph:]] -> [!-~] Printable and visible characters
[[:lower:]] -> [a-z] Lower-case alphabetic characters
[[:print:]] -> [ -~] Printable (non-Control) characters
[[:punct:]] -> [!-/:-@[-`{-~] Punctuation characters
[[:space:]] -> [ \t\v\f] All whitespace chars
[[:upper:]] -> [A-Z] Upper-case alphabetic characters
[[:xdigit:]] -> [0-9a-fA-F] Hexadecimal digit characters
URL
http://www.ptug.org/sed/sedfaq.htm
EOF
|
ÀÌÀü±Û : [PHP] strtr, preg_replace, str_replace
´ÙÀ½±Û : [grep /egrep]
|
from 61.254.75.40
JS(Redhands)Board 0.4 +@
|
|