377376 附加到文件(Windows -> Unix) [英] 377376 Appended to file (Windows -> Unix)

查看:18
本文介绍了377376 附加到文件(Windows -> Unix)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个执行以下操作的 SSIS 包.

I have an SSIS package that performs the following.

  1. 运行 SQL 脚本
  2. 将结果导出到平面文件(UTF-8 编码、; 分隔和 用于换行)
  3. FTP 结果到solaris 机器(二进制格式)
  1. Run SQL script
  2. Export results to flat file (UTF-8 Encoded, ; delimitated, and for new lines)
  3. FTP results to solaris machine ( binary format )

问题是,当文件出现在我的solaris 机器上时,它在文件的开头有以下内容.

The problem is, that when the file is shows up on my solaris box it has the following at the start of the file.

377376

我已经尝试过 dos2unix,但仍然没有解决问题.事实上,它将377376 更改为227226,不是很有帮助.

I have tried dos2unix and still has not corrected the issue. In fact it changes the 377376 to 227226, not very helpful.

我的问题,有什么办法可以从我的文件中删除这些字符?当他们在那里时,他们会弄乱 grep 和其他 unix 工具,比如 head.

My question, any way to remove these characters from my file? When they are there they mess with grep and other unix tools like head.

推荐答案

默认情况下,任何 SSIS 或 windows 编码的文件都是 UCS-2-LITTLE-ENDIAN 编码的.最简单的方法是使用以下命令在您的 unix 服务器上对文件进行编码.

By default any SSIS or windows encoded file is UCS-2-LITTLE-ENDIAN encoded. The easiest way is to encode the file on your unix server with the following commands.

  1. 使用 iconv 切换到 UTF-8(或您需要的任何编码)

  1. Switch over to UTF-8 (or whatever encoding you need) with iconv

iconv -f UCS-2-LITTLE-EDIAN -t UTF-8 输入 >输出

iconv -f UCS-2-LITTLE-EDIAN -t UTF-8 input > output

删除 ms 添加到留置权末尾的回车符.

Remove the carriage returns that ms adds to the end of liens.

unix2dos -ascii utf-8-file 输出文件

unix2dos -ascii utf-8-file outputfile

这篇关于377376 附加到文件(Windows -> Unix)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆