我需要找出我的列表中是否有几个字符串存在于扩展名为.txt和.xml的文件列表中。
我有自己的字符串列表:"hello"、"goodbye"、"etc"。
我需要包含"hello"、"goodbye"或"etc"的文件列表。
例如:
a.csv contains:
a|b|hello|d
b.xml contains:
<a>
<b></b>
<c>goodbye</c>
</a>本例中的文件列表为:
/path/folder1/a.csv
/path/folder2/b.xml然后,使用文件夹名称重新校准:
/path/folder1/a.csv.folder1
/path/folder2/b.xml.folder2发布于 2014-11-12 22:24:55
要获取包含特定单词的文件列表,您可以执行以下操作:
Profile remoteProfile = ProfileBuilder.newBuilder()
.name("Remote folder1")
.filePath("/path/folder1/*")
.onRemotehost("172.xx.xx.xx")
.credentials("user", "password")
.build();
System.out.println(grep(constantExpression("hello"),on(remoteProfile),with(option(filesMatching()))));详情请参阅https://code.google.com/p/grep4j/wiki/ProfileWithWildcard
https://stackoverflow.com/questions/26887803
复制相似问题