?
Solved

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

Posted on 2011-02-23
3
Medium Priority
?
695 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 79

Accepted Solution

by:
arnold earned 2000 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 79

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

771 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