Skip to content

Instantly share code, notes, and snippets.

@Linusstrom
Created March 29, 2012 17:20
Show Gist options
  • Save Linusstrom/2240236 to your computer and use it in GitHub Desktop.
Save Linusstrom/2240236 to your computer and use it in GitHub Desktop.
import java.io.*;
public class Frastrad {
public static void main(String[] args){
try {
BufferedReader reader =
new BufferedReader(new FileReader(args[0]));
BufferedWriter writer =
new BufferedWriter(new FileWriter(args[1]));
String line = reader.readLine();
while(line != null) {
String[] splitter = line.split(" ");
line = reader.readLine();
for(int i = 0; i < splitter.length; i++) {
if(splitter[i].endsWith(")") && splitter[i].length() > 1) {
writer.write(splitter[i].substring(0, splitter[i].length() - 1) + " ");
}
}
writer.write("\n");
}
writer.close();
reader.close();
}
catch(IOException e) {
System.err.println("The file " + args[0] +
"does not exist.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment