UNIX/コマンド/テキスト処理/cut


xxxxxxxx:*:22222:1000:AAAAAAA:/home/xxxxxxxx:/usr/local/bin/tcsh
xxxxxxxx:*:33333:1000:BB:/home/xxxxxxxx:/usr/local/bin/tcsh
xxxxxxxx:*:11111:1000:CCC:/home/xxxxxxxx:/bin/csh
xxxxxxxx:*:44444:1000:DDDDD:/home/xxxxxxxx:/usr/local/bin/tcsh
xxxxxxxx:*:22222:1000:EEEEEE:/home/xxxxxxxx:/usr/local/bin/bash
% cut -c5-30 [file]
xxxx:*:22222:1000:AAAAAAA:
xxxx:*:33333:1000:BB:/home
xxxx:*:11111:1000:CCC:/hom
xxxx:*:44444:1000:DDDDD:/h
xxxx:*:22222:1000:EEEEEE:/
% cut -c1,3,7
% cut -c-30
% cut -c30-
% cut -c1-3,4,7-
% cut -f1-4 -d":" [file]
xxxxxxxx:*:22222:1000
xxxxxxxx:*:33333:1000
xxxxxxxx:*:11111:1000
xxxxxxxx:*:44444:1000
xxxxxxxx:*:22222:1000

% cut -f1-4 -d":" --output-delimiter="<>" [file]
xxxxxxxx<>*<>22222<>1000
xxxxxxxx<>*<>33333<>1000
xxxxxxxx<>*<>11111<>1000
xxxxxxxx<>*<>44444<>1000
xxxxxxxx<>*<>22222<>1000
% awk -F: '{print $1"<>"$2"<>"$3"<>"$4}' [file]

xrea