Setting Java VM line.separator

Try using java -Dline.separator=$’\n’. That should do the trick, at least in bash. Here is a test-run: aioobe@r60:~/tmp$ cat Test.java public class Test { public static void main(String[] args) { System.out.println(“\”” + System.getProperty(“line.separator”) + “\””); } } aioobe@r60:~/tmp$ javac Test.java && java -Dline.separator=$’\n’ Test ” ” aioobe@r60:~/tmp$ Note: The expression $” uses the Bash feature … Read more

What is the difference between a “line feed” and a “carriage return”?

A line feed means moving one line forward. The code is \n.A carriage return means moving the cursor to the beginning of the line. The code is \r. Windows editors often still use the combination of both as \r\n in text files. Unix uses mostly only the \n. The separation comes from typewriter times, when … Read more

Writing a new line to file in PHP (line feed)

Replace ‘\n’ with “\n”. The escape sequence is not recognized when you use ‘. See the manual. For the question of how to write line endings, see the note here. Basically, different operating systems have different conventions for line endings. Windows uses “\r\n”, unix based operating systems use “\n”. You should stick to one convention … Read more

What are carriage return, linefeed, and form feed?

Carriage return means to return to the beginning of the current line without advancing downward. The name comes from a printer’s carriage, as monitors were rare when the name was coined. This is commonly escaped as \r, abbreviated CR, and has ASCII value 13 or 0x0D. Linefeed means to advance downward to the next line; … Read more