Solved

How to convert a Windows text file to a Unix text file by using BCP ?

Posted on 2011-02-23
3
681 Views
Last Modified: 2012-05-11
Hi Experts

Do you know a way to convert a Windows text file to a UNIX text file by using BCP ?

By the way
Whtat's the difference betwenn  Windows and UNIX  line terminator
Unix  =>  \r\n
Windows=>\n

Thanks in advance.
0
Comment
Question by:Eduardo Fuerte
  • 2
3 Comments
 
LVL 77

Accepted Solution

by:
arnold earned 500 total points
ID: 34963713
Windows is actually a \r which is refelcted as ^M when on the unix side you do cat -v filename.
<CR><LF> Unix
<cr> windows

When trafnsferring a file via FTP, make sure you use ASCII mode which will convert the <cr> seen in a windows environement into a <CR><LF>.

http://www.december.com/html/spec/ascii.html

On the unix side there is a dos2unix tool that will do the conversion/adjustment after the file was transferred.
dos2unix filename.
 you could use a vb script to go through and adding the char(10) at the end of every line.
0
 

Author Comment

by:Eduardo Fuerte
ID: 34964021
Ok, but do you know a BCP clause to automatize the generation directly to UNIX txt standard ?

0
 
LVL 77

Expert Comment

by:arnold
ID: 34966046
You could use the terminate line by -r "\r\n" but I am uncertain.
http://msdn.microsoft.com/en-us/library/ms191485.aspx

ROWTERMINATOR="\r\n"
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question