All Downloads are FREE. Search and download functionalities are using the official Maven repository.

utsupport.replace Maven / Gradle / Ivy

package utsupport;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;

public class replace
{
	public static void main(String[] argv) throws Exception
	{
		System.out.println("Pre '" + argv[2] + "'");
		System.out.println("Post '" + argv[3] + "'");

		BufferedReader breader = new BufferedReader(new FileReader(argv[0]));
		BufferedWriter bwriter = new BufferedWriter(new FileWriter(argv[1]));

		String line = null;

		while ((line = breader.readLine()) != null)
		{
			bwriter.write(line.replaceAll(argv[2], argv[3]));
			bwriter.write("\n");
		}

		bwriter.close();
		breader.close();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy