import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Stream;

public class TextTest {
	public static void main(String[] args) {
		Path path1 = Paths.get("test.log");
		Path path2 = Paths.get("test.log-2");

		try (Stream stream = Files.lines(path1)) {
			Files.write(path2, (Iterable)stream.filter(s->s.trim().startsWith("{")).filter(s->s.trim().endsWith("}"))::iterator);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}


+ Recent posts