1 | $ sed -e 's/$/\r/' myunix.txt > mydos.txt |
1 | $ sed -e 's/.$//' mydos.txt > myunix.txt |
1 | foo bar oni |
1 | oni bar foo |
1 | $ sed -e '1!G;h;$!d' forward.txt > backward.txt |
1 2 | 28 Aug 2000 food - - Y Supermarket 30.94 25 Aug 2000 watr - 103 Y Check 103 52.86 |
1 2 3 | !Type:Bank D08/28/2000 T-8.15 N PCHECKCARD SUPERMARKET ^ D08/28/2000 T-8.25 N PCHECKCARD PUNJAB RESTAURANT ^ D08/28/2000 T-17.17 N PCHECKCARD SUPERMARKET |
1 2 3 4 5 | D<数据> T<交易量> N<支票号> P<描述> ^ (这是字段分隔符) |
1 | 1d /^^/d s/[[:cntrl:]]//g |
1 2 3 4 5 6 7 8 9 | 1d /^^/d s/[[:cntrl:]]//g /^D/ { s/^D\(.*\)/\1\tOUTY\tINNY\t/ s/^01/Jan/ s/^02/Feb/ s/^03/Mar/ s/^04/Apr/ s/^05/May/ s/^06/Jun/ s/^07/Jul/ s/^08/Aug/ s/^09/Sep/ s/^10/Oct/ s/^11/Nov/ s/^12/Dec/ s:^\(.*\)/\(.*\)/\(.*\):\2 \1 \3: } |
1 | D08/28/2000 |
1 | 08/28/2000 OUTY INNY |
1 | Aug 28 2000 OUTY INNY |
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1d /^^/d s/[[:cntrl:]]//g /^D/ { s/^D\(.*\)/\1\tOUTY\tINNY\t/ s/^01/Jan/ s/^02/Feb/ s/^03/Mar/ s/^04/Apr/ s/^05/May/ s/^06/Jun/ s/^07/Jul/ s/^08/Aug/ s/^09/Sep/ s/^10/Oct/ s/^11/Nov/ s/^12/Dec/ s:^\(.*\)/\(.*\)/\(.*\):\2 \1 \3: N N N s/\nT\(.*\)\nN\(.*\)\nP\(.*\)/NUM\2NUM\t\tY\t\t\3\tAMT\1AMT/ s/NUMNUM/-/ s/NUM\([0-9]*\)NUM/\1/ s/\([0-9]\),/\1/ } |
1 | 28 Aug 2000 OUTY INNY \nT-8.15\nN\nPCHECKCARD SUPERMARKET |
1 | '\nT.*\nN.*\nP.*' |
1 | s/\nT\(.*\)\nN\(.*\)\nP\(.*\)/NUM\2NUM\t\tY\t\t\3\tAMT\1AMT/ |
1 | 28 Aug 2000 OUTY INNY NUMNUM Y CHECKCARD SUPERMARKET AMT-8.15AMT |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |