1. 首页
  2. IT资讯

[20190710]windows文本格式.txt

[20190710]windows文本格式.txt

–//大家都知道windows文本格式是回车换行,与linux的文本格式存在一点点不同。
–//最近在windows下遇到一些问题,做1个记录。

D:>seq 4 > d:a
D:>ls -l a
-rw-rw-rw-   1 user     group          12 Jul 10 17:33 a

D:>xxd -c 16 a
0000000: 310d 0a32 0d0a 330d 0a34 0d0a            1..2..3..4..

–//你可以发现生成的文本格式是windows的文本格式。如果执行如下:
D:>seq 4 | xargs -iQ C:WINDOWSsystem32echo -e "create table tQ as select level id from dual connect by level<=power(4,Q)"
)as select level id from dual connect by level<=power(4,1
)as select level id from dual connect by level<=power(4,2
)as select level id from dual connect by level<=power(4,3
)as select level id from dual connect by level<=power(4,4
–//看到的输出很奇怪。
·
D:>seq 4 | xargs -iQ C:WINDOWSsystem32echo -e "create table tQ as select level id from dual connect by level<=power(4,Q)" > a

–//如果使用vim打开,可以发现实际上这里的Q在替换时带r字符的。
create table t1
 as select level id from dual connect by level<=power(4,1
)
create table t2
 as select level id from dual connect by level<=power(4,2
)
create table t3
 as select level id from dual connect by level<=power(4,3
)
create table t4
 as select level id from dual connect by level<=power(4,4
)
–//也就是通过传递过来的是带有r字符。
–//也就是要加一个过滤删除里面的r字符。执行如下:

D:>seq 4 | tr -d "r" | xargs -iQ C:WINDOWSsystem32echo -e "create table tQ as select level id from dual connect by level<=power(4,Q);"
create table t1 as select level id from dual connect by level<=power(4,1);
create table t2 as select level id from dual connect by level<=power(4,2);
create table t3 as select level id from dual connect by level<=power(4,3);
create table t4 as select level id from dual connect by level<=power(4,4);

–//这样小问题浪费半个小时,做一个记录很有必要。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2650452/,如需转载,请注明出处,否则将追究法律责任。

主题测试文章,只做测试使用。发布者:深沉的少年,转转请注明出处:http://www.cxybcw.com/182906.html

联系我们

13687733322

在线咨询:点击这里给我发消息

邮件:1877088071@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code