Solved

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

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

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 76

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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.:

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now