Created
August 6, 2009 00:23
-
-
Save twopoint718/163060 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.*; | |
| import java.util.*; | |
| public class LineBreaker | |
| { | |
| public static void main(String[] args) | |
| { | |
| if (args.length < 1) { | |
| System.err.println("Give the name of the file as an argument."); | |
| System.exit(1); | |
| } | |
| BufferedReader in = null; | |
| String line = null; | |
| try { | |
| in = new BufferedReader(new FileReader(args[0])); | |
| line = in.readLine(); | |
| } catch (Exception e) { | |
| e.printStackTrace(); | |
| } | |
| String lines = line.replaceAll(",0", "\n"); // insert newlines | |
| lines = lines.replaceAll(",", "\t"); // insert tabs | |
| System.out.print(lines); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment