¸î°¡Áö ¿¹Á¦ ½ºÅ©¸³Æ®µé

GNU SED ¿Í ÇÔ²² ¹èÆ÷µÇ´Â dc.sed¶ó´Â ³î¶ó¿î ½ºÅ©¸³Æ®°¡ ÀÖÀ¸³ª, ´ÙÀ½ ¿¹Á¦¸¦ Çѹø º¸½Ê½Ã¿ä.

¿¹Á¦¿ë µ¥ÀÌŸ
        wolf@zizik.net]$ cat /etc/hosts
        231.101.9.11    ulsan           ¿ï»ê  101
        231.102.9.11    kangbyun        °­º¯  102
        231.104.9.11    world           ¿ùµå  104
        231.107.9.11    seohyun         ¼­Çö  107
        231.108.9.11    chungju         ûÁÖ  108
        231.109.9.11    kuri            ±¸¸®  109
        231.111.9.11    bupyung         ºÎÆò  111
        231.112.9.11    juyeup          ÁÖ¿±  112
        231.113.9.11    daejun          ´ëÀü  113
        231.114.9.11    yeonsu          ¿¬¼ö  114
        231.115.9.11    chunan          õ¾È  115
        231.116.9.11    sangmu          »ó¹«  116
        231.117.9.11    saha            »çÇÏ  117
        231.118.9.11    daegu           ´ë±¸  118
        3.7.23.107      kwanak          °ü¾Ç  119
        3.7.23.232      pusan           ºÎ»ê  120
        3.1.2.229       ilsan           ÀÏ»ê  121
½¬¿î ¿¹Á¦.

["»ê"ÀÌ µé¾î°¡´Â È£½ºÆ®¸¸ ã¾Æ¼­ ip address »Ì¾Æ³»±â]

        wolf@zizik.net]$ sed -n -e '/Ȑ/ s/\([0-9.]*\) *[a-z]* *\([^ ]*\).*/\2 =====> \1/p;' /etc/hosts
        ¿ï»ê =====> 231.101.9.11
        ºÎ»ê =====> 3.7.23.232
        ÀÏ»ê =====> 3.1.2.229
Á» ¾î·Á¿î ¿¹Á¦.

[È£½ºÆ® ±¸¸®±îÁö ÀÐ°í ¼Ò¹®ÀÚ abcde ¸¦ ´ë¹®ÀÚ ABCDE ·Î ¹Ù²Ù°í ¹ØÁÙ ±ß±â, È£½ºÆ® ´ë±¸±îÁö ÀÐ°í ³ª¸ÓÁö ¼Ò¹®ÀÚ¸¦ ´ë¹®ÀÚ·Î ¹Ù²Ù°í ¹ØÁٱ߱â, ¸¶Áö¸·Çà±îÁö ÀÐ°í ¼ýÀÚ(0-9)¸¦ '¼ýÀÚ'·Î ¹Ù²Ù°í ¹ØÁٱ߱â]

        wolf@zizik.net]$ cat sample.sed
        H

        /kuri/ {
                g
                y/abcde/ABCDE/
                a \
                _______________________
                p
                n
                h
               }
        
        /daegu/ {
                g
                y/fghijklmnopqrsutvwxyz/FGHIJKLMNOPQRSUTVWXYZ/
                a \
                _______________________
                p
                n
                h
               }
        $ {
                g
                s/[0-9]/¼ýÀÚ/g
                a \
                _______________________
                p
               }

        wolf@zizik.net]$ sed -n -f sample.sed /etc/hosts

        231.101.9.11    ulsAn           ¿ï»ê  101
        231.102.9.11    kAngByun        °­º¯  102
        231.104.9.11    worlD           ¿ùµå  104
        231.107.9.11    sEohyun         ¼­Çö  107
        231.108.9.11    Chungju         ûÁÖ  108
        231.109.9.11    kuri            ±¸¸®  109
        _______________________
        231.111.9.11    bUPYUNG         ºÎÆò  111
        231.112.9.11    JUYeUP          ÁÖ¿±  112
        231.113.9.11    daeJUN          ´ëÀü  113
        231.114.9.11    YeONSU          ¿¬¼ö  114
        231.115.9.11    cHUNaN          õ¾È  115
        231.116.9.11    SaNGMU          »ó¹«  116
        231.117.9.11    SaHa            »çÇÏ  117
        231.118.9.11    daeGU           ´ë±¸  118
        _______________________
        ¼ýÀÚ.¼ýÀÚ.¼ýÀÚ¼ýÀÚ.¼ýÀÚ¼ýÀÚ¼ýÀÚ      kwanak          °ü¾Ç  ¼ýÀÚ¼ýÀÚ¼ýÀÚ
        ¼ýÀÚ.¼ýÀÚ.¼ýÀÚ¼ýÀÚ.¼ýÀÚ¼ýÀÚ¼ýÀÚ      pusan           ºÎ»ê  ¼ýÀÚ¼ýÀÚ¼ýÀÚ
        ¼ýÀÚ.¼ýÀÚ.¼ýÀÚ.¼ýÀÚ¼ýÀÚ¼ýÀÚ       ilsan           ÀÏ»ê  ¼ýÀÚ¼ýÀÚ¼ýÀÚ
        _______________________