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
Solved

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

Posted on 2011-02-23
3
685 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
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 …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

809 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