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
2
votes
1 answer

How to pipe into and out of dos2unix on a mac

The below "one liner" explains what I'm trying to do: pbpaste > ~/Documents/convertme.txt; \ dos2unix -c mac ~/Documents/convertme.txt && \ cat ~/Documents/convertme.txt | pbcopy && \ rm -vfr ~/Documents/convertme.txt I don't like creating a…
Jeremy Iglehart
  • 4,281
  • 5
  • 25
  • 38
2
votes
3 answers

Dos2unix on Java files

Are there any impacts or repercussions if the dos2unix command is run on Java source files, right before they are compiled? The Java files would be downloaded from a CVS repository in Linux and then compiled to a jar by an Ant script. Thanks.
Vince-V
  • 23
  • 4
2
votes
2 answers

Checking for DOS files on UNIX

I want to check whether any DOS files exist in any specific directory. Is there any way to distinguish DOS files from UNIX apart from the ^M chars ? I tried using file, but it gives the same output for both. $ file test_file test_file: ascii…
niks7
  • 35
  • 2
  • 4
2
votes
1 answer

Difference dos2Unix and python script

I have files to convert to Unix format. What would be the differences/issues that I could face choosing python conversion way : import sys filename = sys.argv[1] text = open(filename, 'rb').read().replace('\r\n', '\n') open(filename,…
user3278877
  • 173
  • 4
  • 13
2
votes
3 answers

Text files appearing as bynaries on Mac Os X

I have >5000 textual files generated in Windows from PDF files that I need to process on a Mac OS X machine. I run dos2unix on all of them to correct the newline and to convert the encoding from UTF-16LE to UTF-8. In 4949 cases everything goes…
agaved
  • 258
  • 2
  • 9
1
vote
0 answers

sed caret ^ ignored in python running in Cygwin?

I have a file that I'm trying to run a "sed" command on, but I'm having trouble executing it within Python 3.10.1 while I'm running it on Cygwin 3.5.1. The file I'm working on is very simple, it looks like this: (Distance competency) 1.…
Brandon
  • 11
  • 1
1
vote
2 answers

How do I replace "\r" line endings when running Docker script on Windows?

I'm using Docker 19 on Windows 10 (using Cygwin to run Docker). I have this web/Dockerfile ... FROM python:3.7-slim RUN apt-get update && apt-get install RUN apt-get install -y dos2unix RUN apt-get install -y libmariadb-dev-compat…
Dave
  • 15,639
  • 133
  • 442
  • 830
1
vote
1 answer

C++ program adding ^M characters

I'm editing a python file and my program iterates through every line and if the string "if" exists, it appends a comment to it. The program does work but it adds ^M and I can no longer see the code on GitHub as it appears as a raw file. Looking at…
blodzbyte
  • 11
  • 2
1
vote
1 answer

Bash scripts Git cloned in VSCode are automatically converted to DOS format

Platform: Windows 10 Editor: VSCode Hi, I am working on Windows using WSL and develop on VSCode. I notice that whenever I clone a project that contains Bash scripts into VSCode, these scripts are automatically converted to DOS format which means…
Kefeng91
  • 802
  • 6
  • 10
1
vote
2 answers

dos2unix format conversion error while execution through TeamCity

While trying to transfer file from Windows to Unix Azure environment, I am getting error dos2unix format error dos2unix -o /xyz/home/ABC_efg.txt failed to execute dos2unix format change. I tried to run a PS script to fix it but does seem to work .…
Anupam
  • 284
  • 5
  • 21
1
vote
2 answers

dos2unix command

I have this script #!/bin/sh for i in `ls -R` do echo "Changing $i" fromdos $i done I want to remove "^M" charcaters from many files which are in more subdirectories. I got this: fromdos: Unable to access file Is there somethig i'm…
Fernando
  • 13
  • 1
  • 5
1
vote
2 answers

How do I pipe `dos2unix` into `while read` in bash?

Right now, I'm trying to fix an issue in my PrintBans.sh script. The problem is, the program that generates this file saves it with \r\n line endings, so I need the while loop to be able to read \r\n lines, otherwise there's an extra \r at the end…
PatPeter
  • 394
  • 2
  • 17
1
vote
1 answer

Unable to suppress output of dos2unix command in jenkins console output

I have a Jenkins triggered project which has the following command wrapped in a PHP exec - $dos2unix = exec("dos2unix ".$filePath); It shows the following unwanted command output in the Jenkins console output and clutters the screen - dos2unix:…
Sandeepan Nath
  • 9,966
  • 17
  • 86
  • 144
1
vote
0 answers

Bad array subscript(UNIX)

hi guys i know this question has been asked several time out there.But i have tried a lot and i am not able to get what is the issue .Below is my code -: #!/bin/bash #GLOBAL VARIABLE name=() browserTime=0 …
Randomguy
  • 192
  • 1
  • 11
1
vote
1 answer

Reading file mtime in UNIX in particular format (2013-06-25 09:04:32)

hi i have this file on my UNIX box (SunOS 5.10). -rwxr-xr-x 1 phnxep siebel 917 Feb 1 02:52 crontest.sh Here date and time are given like Feb1 02:52.Can i just read these values in UNIX for my file ignoring the rest of the details.In the…
Randomguy
  • 192
  • 1
  • 11