23 3 ( ( (binary file) UNIX CUI 3.1 = + 2 bit ) ( 3.1) bit bit 1 Byte=8 bit 1 Byte ASCII, JIS X 0201 ASCII(American Standard Code for Information Interchange) 7bit (;) (:) ( ) (") ) 7bit ( )
24 3 3.1 ( ) Shift JIS ( ) ASCII ASCII ( ) 8bit = 1 Byte JIS(Japan Industrial Standard) X 0201 (X ) 2 Byte JIS ISO-2022-JP, Shift JIS, EUC 1 Byte 2 Byte JIS X 0208 2 JIS JIS X 0208 3 E-mail ISO[3] 2022-JP (MTA, Message Transfer Agent) Unicode Shift JIS Microsoft MS-DOS(Windows CUI OS) MS JIS X 0208 (shift ) JIS X 0201 2 byte 1 Byte JIS X 0201 Windows Unicode OS Shift JIS
3.2 25 EUC (Extended UNIX Code) UNIX EUC EUC Linux Vine Linux EUC Unicode 4 Byte Unicode Unicode( )[4] 21 bit < 4 Byte (CJK, China-Japan-Korea) Windows UNIX OS Unicode 4 Byte (CPU Unicode Unicode 1 Byte 2 Byte, 4 Byte UTF-8, UTF-16, UTF-32 ASCII OS UTF-8 CentOS 5 UTF-8 3.2 (redirect) (pipe) 3.2.1 (P.vii ) UNIX cat soccer.txt 27 ) soccer yomi.txt 27 soccer title.txt 3 Web Web TeraTerm cat
26 3 $ cat > soccer.txt cat > > cat (<) cat Web TeraTerm [CTRL] + [z] $ cat > soccer.txt ) FW 177 73 1977/5/27 ˆZ [CTRL] [z] [1]+ Stopped cat >soccer.txt $ $ ls soccer.txt $ cat soccer.txt FIFA TM GK 184 80 1973/7/25 ( ) FW 177 73 1977/5/27 soccer yomi.txt, soccer title.txt cat 3.2.2 wc $ wc soccer.txt
3.3 grep, sort, join 27 $ cat soccer.txt wc ( ) cat soccer.txt soccer.txt wc 3.2.3 wc $ wc soccer.txt > wc_soccer.txt wc soccer.txt 3.3 grep, sort, join 3 grep sort join ( ) 3.3.1 grep grep $ grep soccer.txt DF 178 74 1975/8/8 DF 177 74 1976/11/23 MF 181 77 1976/9/1
28 3 $ grep soccer.txt DF 178 74 1975/8/8 DF 177 74 1976/11/23 MF 181 77 1976/9/1 ASCII $ grep 2$ soccer.txt GK 187 80 1979/8/2 MF 175 72 1977/1/22 2 $ $ grep /* * soccer.txt DF 178 74 1975/8/8 DF 177 74 1976/11/23 MF 181 77 1976/9/1 * ( ) [ 1-2] 1 2 $ grep /*[3-5]$ soccer.txt GK 184 80 1973/7/25 GK 185 76 1976/4/15 DF 176 69 1974/7/24 DF 177 74 1976/11/23 DF 183 78 1977/3/14 DF 187 78 1978/2/25 DF 175 67 1980/1/13 MF 178 73 1978/6/24 MF 173 72 1979/4/5 FW 182 75 1976/6/5 FW 181 75 1979/6/4 FW 177 74 1980/5/4 ASCII 3 5 (.) ( )
3.3 grep, sort, join 29 $ grep /.[1-2]$ soccer.txt MF 175 72 1977/1/22 FW 173 67 1980/4/11 $ grep /*[1-2]$ soccer.txt GK 187 80 1979/8/2 MF 181 77 1976/9/1 MF 175 72 1977/1/22 FW 173 67 1980/4/11 3.3.2 sort sort soccer yomi.txt (-k2 ) $ sort -k2 soccer_yomi.txt ( ) -r $ sort -r -k2 soccer_yomi.txt 3.3.3 join join $ join -j1 2 -j2 1 -o 1.1 1.2 2.2 1.3 1.4 1.5 1.6 soccer.txt socc er_yomi.txt GK 184 80 1973/7/25 ( ) FW 177 73 1977/5/27 soccer.txt soccer yomi.txt -o
30 3 soccer.txt 1 soccer yomi.txt 2 1.1 soccer.txt 2.2 soccer yomi.txt 2 (= soccer.txt 1 ) 1.3 soccer.txt 3 A soccer.txt soccer yomi.txt soccer title.txt soccer meibo.txt ( 3.2 ) 3.2 soccer meibo.txt 3.4 ( ) UNIX (./) (../) soccer meibo.txt unix05
3.5 sed 31 unix05 unix05 $ ls../unix04 unix05 unix04 ( ) soccer_meibo.txt ( ) $ cp../unix04/soccer_meibo.txt./ unix04 succer_meibo.txt $ cat soccer_meibo.txt soccer_meibo.txt 3.5 sed sed sed $ sed grep MF $ sed s/mf/ / soccer_meibo.txt FIFA TM 181 75 1979/9/18 ( ) FW 177 73 1977/5/27 soccer meibo.txt 1,3d (;) $ sed 1,3d;s/MF/ / soccer_meibo.txt 181 75 1979/9/18 ( ) FW 177 73 1977/5/27 $ sed 1,3d;s/ /Y=t/ soccer_meibo.txt $ sed 1,3d;s/ /Y=t/g soccer_meibo.txt
32 3 3.6 awk ( ) CPU *1 C, C++, Fortran CGI(Common Gateway Interface) awk, Web PHP, Ruby Perl 3.7 awk C /UNIX C/C++ Perl Perl awk.awk.awk 3 BEGIN { } { } END{ } BEGIN{ }, END{ } { } *1 Java.NET ( )
3.7 awk 33 awk : 1: BEGIN{print "--- ---Y=n";} 2: {print $1; print $5; print $6; count++;} 3: END{print "Y=n ", count, " "; print "--- ---Y=n";} $ sed 1,3d soccer_meibo.txt awk -f sample.awk --- --- 181 75 177 73 26 --- --- B 1. (,) CSV (.csv) sed soccer meibo.txt soccer meibo.csv sed $ sed 1,3d; ( ); soccer_meibo.txt, MF,,, FW,, $ sed 1,3d; ( ); soccer_meibo.txt > soccer_meibo.csv 2. awk soccer meibo.txt awk ave.awk sed ave.awk
34 3 $ sed "1,3d" soccer_meibo.txt awk -f ave.awk MF FW : 178.923 : 73.0385 3 awk