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
1
vote
1 answer

(standard_in) 1: illegal character: ^M - dos2Unix not working?

My Script is : #!/bin/bash LGREEN='\033[1;32m' LBLUE='\033[1;36m' NC='\033[0m' function convertToTime { min=$(echo "$min+$sec/60" | bc) sec=$(echo "$sec%60" | bc) hrs=$(echo "$hrs+$min/60" | bc) min=$(echo "$min%60" |…
Somenath Sinha
  • 1,174
  • 3
  • 16
  • 35
1
vote
2 answers

How to remove stray ^M and <96> from text file before import into sas

I receive a pipe-delimited text file from a user that populates an excel spreadsheet using screen scrapes, so the data is a mess. It is full of random ^M (carriage returns) and <96> (windows en dash) throughout which causes the import to be…
Morgan
  • 11
  • 1
1
vote
3 answers

how to convert ^M$ newline from dos to unix (dos2unix didn't work)

was trying to remove the erroneous newline characters generated from Windows. $cat -e file.xml foo^M$ bar$ $ hello world1$ hello world2$ where there should be "foobar" without any newlines in between while all the newlines should be retained. I…
galactica
  • 1,753
  • 2
  • 26
  • 36
1
vote
1 answer

Using com.opencsv.CSVReader on windows stops reading lines prematurely

I have two files that are identical except for the line ending codes. The one that uses the newline (linux/Unix)character works (reads all 550 rows of data) and the one that uses carriage return and line feed (Windows) stops returning lines after…
Ron
  • 409
  • 1
  • 4
  • 9
1
vote
1 answer

Avoid needing dos2unix in php

We used to edit a payload script via the terminal on an old server. To ease up and avoid typos I'd like to design a php script that generates the payload, save it to a file and use the built-in FTP functionality in PHP to upload the file to the FTP…
EDP
  • 309
  • 1
  • 6
  • 18
1
vote
2 answers

Git rebase applying dos2unix at each step

I've a series of commits to a file that I now realize was created with incorrect line endings. I want to rebase the commits and apply dos2unix command at each step. I can't see an easy way to do this as after each step git registers a full…
EoghanM
  • 25,161
  • 23
  • 90
  • 123
1
vote
1 answer

dos2unix support for file with unicode characters

i use dos2unix to remove control-m characters, i works fine for normal text file. But for text files with unicode characters it replaces all unicode characters with junk character. Please let me know how to use dos2unix for files with unicode…
Prasad
  • 519
  • 9
  • 22
1
vote
2 answers

Bash alias file corrupted: No such file or directory

I have/had ~/.bashrc_aliases.sh (a file containing bash aliases) sourced by my ~/.bashrc file. This ~/.bashrc_aliases.sh file somehow happened to be in DOS format which I fixed by running dos2unix on the file. When this alias file was in 'DOS'…
Bryan Ritter
  • 123
  • 1
  • 7
1
vote
2 answers

find grep exclude some file names for dos2unix

so far I have gotten this far: prompt$ find path/to/project -type f | grep -v '*.ori|*.pte|*.uh|*.mna' | xargs dos2unix 2> log.txt However, the files with extensions .ori, .pte, .uh and .mna still show up.
Sassinak
  • 95
  • 2
  • 12
0
votes
1 answer

Why can't emacs elisp function 'search-forward' find carriage return characters anymore?

This code for dos2unix conversion in an emacs buffer stopped working at some point. I've been using it since the 90's (emacs 19) and I don't know exactly when it stopped working. ;;; Dos to Unix conversion in buffer (defun dos2unix () "convert…
0
votes
0 answers

Git ignore CRLF/LF changes after used dos2unix

Hi I have a dockerized project which I tried to run using docker desktop but I got the error env: bash\r: No such file or directory and searching through I found the solution, using dos2unix. https://github.com/TizenTeam/dos2unix But using it makes…
H3lltronik
  • 562
  • 8
  • 26
0
votes
1 answer

How to convert a text file from DOS format to UNIX format

I am trying to make a program in C, that reads a text file and replace \r\n with \n to the same file converting the line ending from DOS to UNIX. I use fgetc and treat the file as a binary file. Thanks in advance. #include int main() { …
0
votes
1 answer

What's wrong with repeating entries in awk print statements?

I was trying to answer this other question, about how to repeat an existing column. I thought this to be fairly easy, just by doing something like: awk '{print $0 $2}' This, however, only seems to print $0. So, I decided to do some more tests: awk…
Dominique
  • 16,450
  • 15
  • 56
  • 112
0
votes
1 answer

Can we have a similar thing like dos2unix in javascript

I want to know whether we can convert from DOS(CR LF) format to UNIX(LF) format in Javascript/JQuery? In linux/unix, we have a dos2unix command and I'm looking similar thing in javascript. Thanks in advance, happy coding :)
0
votes
1 answer

dos2unix doesn't convert the env file even with -f option

When I ran the the npm command, it threw an error like this. 10:13 $ npm install --legacy-peer-deps > project-client@1.0.0 prepare > scripts/transpile /usr/bin/env: ‘bash\r’: No such file or directory I figured that it had something to do with a…
Sean2014
  • 531
  • 8
  • 30