Questions tagged [dos2unix]

About dos2unix conversion program

unix2dos is a Unix tool to convert an ASCII text file from DOS format (carriage return and line break) to UNIX format (line break).

Also see

94 questions
8
votes
4 answers

How to automate dos2unix using shell script?

I have a bunch of xml files in a directory that need to have the dos2unix command performed on them and new files will be added every so often. I Instead of manually performing dos2unix command on each files everytime I would like to automate it…
Alan Smith
  • 1,069
  • 4
  • 19
  • 23
7
votes
3 answers

echo "string" > file in Windows PowerShell appends non-printable character to the file

In Windows PowerShell: echo "string" > file.txt In Cygwin: $ cat file.txt :::s t r i n g $ dos2unix file.txt dos2unix: Skipping binary file file.txt I want a simple "string" in the file. How do I do it? I.e., when I say cat file.txt I need only…
Girish Vijay
  • 81
  • 1
  • 1
  • 4
6
votes
7 answers

What's the best way of doing dos2unix on a 500k line file, in Windows?

Question says it all, I've got a 500,000 line file that gets generated as part of an automated build process on a Windows box and it's riddled with ^M's. When it goes out the door it needs to *nix friendly, what's the best approach here, is there a…
ninesided
  • 23,085
  • 14
  • 83
  • 107
5
votes
1 answer

How to run dos2unix for all the files in subfolders in bash?

I am using dos2unix *.sh to convert all the .sh files in the current directory. So how to convert all the .sh files in the subfolders as well? I tried this but it does not work for bash: How to run dos2unix for all files in a directory and…
lanselibai
  • 1,203
  • 2
  • 19
  • 35
5
votes
2 answers

dos2unix modifies binary files - why

By default it is not supposed to affect binary files. I tested it in a folder with images and although most images were not affected, a few were. If dos2unix cannot tell a binary file from a text file, must I resort to specifically including and/or…
Buttle Butkus
  • 9,206
  • 13
  • 79
  • 120
5
votes
2 answers

how to convert a file from DOS to Unix

I need to convert a file from DOS to Unix in PowerShell. I know this can be very much easily done in Unix: dos2unix file newfile
judi
  • 89
  • 1
  • 1
  • 10
5
votes
3 answers

Batch convert text files from LF line endings to CRLF

I have a vb.net (visual studio 2010) project that is version controlled with git (1.7.10.msysgit.1). I made a mistake of leaving core.autocrlf to true in git. Now I have set core.autocrlf to false, but the source code is already converted to LF line…
Endy Tjahjono
  • 24,120
  • 23
  • 83
  • 123
4
votes
1 answer

Dos2unix not working when trying to silence command

I was calling dos2unix from within Python this way: call("dos2unix " + file1, shell=True, stdout=PIPE) However to silence the Unix output, I did this: f_null = open(os.devnull, 'w') call("dos2unix " + file1, shell=True, stdout=f_null ,…
methuselah
  • 12,766
  • 47
  • 165
  • 315
4
votes
3 answers

dos2unix in a variable

I need to execute the dos2unix command in a variable. With files we just do dos2unix myfile.txt. How can I do that with a variable? For example: variable="bla\r" dos2unix $variable Sugestions using other commands are also welcome. PS.: I cannot…
hbelmiro
  • 987
  • 11
  • 31
4
votes
3 answers

How to make Maven checking the source end-of-line?

I would like to enforce Unix style end-of-line (\n) in Java sources of our projects for consistency reasons. As many of us work under Windows, most IDEs are configured by default to use Windows style end-of-line (\r\n). We try to change that…
Florent Paillard
  • 549
  • 1
  • 6
  • 20
3
votes
3 answers

Add Control M character in a text file

Hi I am trying to add Control M character in a text file using Putty. I tried to do Ctrl-v Ctrl-M but as soon as I do this it goes out of putty to my desktop home.Can anyone please tell me how to add Ctrl M character in a file
Pramod Bhat
  • 49
  • 1
  • 6
3
votes
2 answers

How to convert dos2unix csv file with python script

I want to convert a csv file into dos2unix format using python in windows. Rightnow I am doing manually by placing csv file in workarea(server) and run command in putty.[Command : dos2unix file_received filename]
3
votes
3 answers

How to convert some files from dos format to unix

I know how to change file format from dos to unix by use dos2unix, but how can I change ALL the files will under a directory tree. Can dos2unix change files recursively? for example, I have some files like following: TOPDIR | +-----dir1 | | | …
How Chen
  • 1,340
  • 2
  • 17
  • 37
3
votes
3 answers

\377\376 Appended to file (Windows -> Unix)

I have an SSIS package that performs the following. Run a SQL script Export the results to a flat file (UTF-8 encoded, ; delimited, and \n for new lines) FTP results to a Solaris machine (binary format) The problem is that when the file shows up…
Freddy
  • 2,249
  • 1
  • 22
  • 31
2
votes
1 answer

Ear encoding inside the archive

These days, I drove crazy to deploy an ear on unix enviroment using Weblogic. At the end I realized by using (cat -v file.properties) that such file was full of ^M at the end of the line. This happened because I edited the properties file on Windows…
Giuseppe Di Federico
  • 3,501
  • 4
  • 20
  • 19