Praveen k. Agrawal
Praveen k. Agrawal

Reputation: 449

Error when converting Windows text file to Unix text file

For converting Windows data file to Unix data file, I'm using dos2unix command but it's not executing. It's giving me the following message:

$ dos2unix new_request.txt testing.txt
ksh: dos2unix:  not found.

Upvotes: 0

Views: 5160

Answers (2)

tripleee
tripleee

Reputation: 189679

If you don't have dos2unix on your system, you can approximate it with

tr -d '\015' <dos.txt >unix.txt

The syntax for tr varies somewhat between systems; check that the output is what you expect, and consult the local tr man page if not. You want to remove the carriage return characters (ASCII 13, hex 0x0D, ctrl-M, aka \r) from the file.

Upvotes: 1

bananafish
bananafish

Reputation: 2917

You either don't have dos2unix or it is not in your system's path. Do one of the following:

  • download dos2unix, maybe from here.
  • put the dos2unix executable in the folder you're doing the conversion in.
  • put dos2unix in your system path.

Upvotes: 1

Related Questions