I am having several files which I want to convert from Dos to Unix. Is there any API or method which will help me to do this?
See Question&Answers more detail:osI am having several files which I want to convert from Dos to Unix. Is there any API or method which will help me to do this?
See Question&Answers more detail:osThere are linux tools that can do this (dos2unix
for example).
In Java it can be done with String.replaceAll()
.
DOS uses
for line termination, while UNIX uses a single
.
String unixText = windowsText.replaceAll("
", "
"); // DOS2UNIX
So no, no API exists. Yes, it is dead easy.