Globally replace text in several files: Difference between revisions

Content added Content deleted
(Added 11l)
(→‎{{header|Java}}: Add Java 11 shorter way.)
Line 686: Line 686:
}
}
}</lang>
}</lang>

In Java 11 the body could be shortened to:
<lang java>
for (String fn : List.of("file1.txt","file2.txt")) {
Path path = Path.of(fn);
Files.writeString(path,
Files.readString(path).replace("Goodbye London!", "Hello New York!"));
}
</lang>


=={{header|jq}}==
=={{header|jq}}==