Solved

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

Posted on 2011-02-23
3
691 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 78

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 78

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

734 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