Hi all,
I am trying to parse the linux /etc/passwd file in java. I'm currently reading each line through the scanner class in java and then using string.split() to delimit each line.
The problem is that the line "list:x:38:38:Mailing List Manager:/var/list:/bin/sh" is treated by the scanner as 3 different lines: 1) "list:x:38:38:Mailing" 2) "List" 3) "Manager..." When I type this out into a new file that I didn't get from linux, the Scanner parses it properly.
Is there something I'm not understanding about new lines in linux?
Obviously a work around is to parse it without using scanner, but it wouldn't be elegant. Does anyone know of an elegant way to do it?
Is there a way to convert the file into one that would work with Scanner?
Please let me know.
Thanks, jbu
Not even two days ago: http://stackoverflow.com/questions/419291/historical-reason-behind-different-line-ending-at-different-platforms
EDIT
Note from the original author:
"I figured out I have a different error that is causing the problem. Disregard question"