当且仅当该行中存在字符串时,我想替换字符串。这应该在文件夹中的所有文件中执行。
1. This is My String.
2. Get This string as input.
如果存在'String',则在上述两个字符串中,将My替换为您的。
类似输出应
1. This is your String.
2. Get This string as input.
答案 0 :(得分:0)
private static final Gson gson = new GsonBuilder()
.registerTypeAdapter(Foo.class, getFooJsonDeserializer())
.create();
public static void main(final String... args) {
final Wrapper wrapper = gson.fromJson("{\"foo\":{\"bar\":\"bar\",\"echo\":\"echo\"}}", Wrapper.class);
System.out.println(wrapper.foo.foo2);
}
OR
sed '/String/ s/My/YOUR/g' input