Hai Fiends,


I need to add \r\n(if \n is present or not) at end of every line of a huge file.
how can i do this in java, with high performance. please help me in this problem.

Recommended Answers

All 4 Replies

please help me in this problem, how to add /r/n in end of every line of a file in java.

You're just going to have to read the source file,and write a copy to an output file, replacing line end characters when you encounter them. Provided you use buffered streams for both files there's not a lot you can do to affect the performance.

> please help me in this problem, how to add /r/n in end of every line of a file in java.

Are you really required to use Java? If not, the simplest and fastest way would be to use "unix2dos" utility if you are on a Unix box or just open the file in Notepad++ -> Format -> Convert to Windows format.

> please help me in this problem, how to add /r/n in end of every line of a file in java.

Are you really required to use Java? If not, the simplest and fastest way would be to use "unix2dos" utility if you are on a Unix box or just open the file in Notepad++ -> Format -> Convert to Windows format.

I want to do this in java...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.