Skip to content

Instantly share code, notes, and snippets.

@twopoint718
Created August 6, 2009 00:23
Show Gist options
  • Select an option

  • Save twopoint718/163060 to your computer and use it in GitHub Desktop.

Select an option

Save twopoint718/163060 to your computer and use it in GitHub Desktop.
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