我已阅读了定位手册页并搜索了此网站,但我不知道如何执行此操作:
我正在寻找以j开头的所有* .vim文件。我如何使用locate来实现这一目标?
[docker@docker1 ~]$ locate java.vim
/usr/share/vim/vim74/ftplugin/java.vim
/usr/share/vim/vim74/indent/java.vim
/usr/share/vim/vim74/syntax/java.vim
[docker@docker1 ~]$ locate "j*.vim"
[docker@docker1 ~]$
答案 0 :(得分:0)
您必须使用// better to broadcast a Map instead of an Array, would make lookups more efficient
val studentB = sc.broadcast(studentdetailsRDD.keyBy(_.StudentId).collectAsMap())
// convert to RDD[String] with the wanted formatting
val resultStrings = studentRDD.map { student =>
val details = studentB.value(student.StudentId)
Array(details.StudentName, details.Course, student.City)
}
.map(_.mkString(",")) // naive CSV writing with no escaping etc., you can also use CSVWriter like you did
// save as text file
resultStrings.saveAsTextFile(outputPath)
命令。
只需输入<?xml version="1.0" encoding="utf-8"?>
<simsrv version="1.0" msg_type="response">
<header>
<param name="SN" value="0" />
<param name="Domain" value="default" />
<param name="User" value="admin" />
<param name="Cmd" value="GetDeviceInfo" />
<param name="Retries" value="0" />
<param name="Timeout" value="5000" />
<param name="Timestamp" value="NA" />
<param name="AuthInfo" value="39ef0f02a9f4d5799481a8d6f2897a0b" />
<param name="ErrorCode" value="SUCCESS" />
<param name="ErrorInfo" value="NA" />
<param name="ProcessTime" value="1" />
</header>
<GetDeviceInfo>
<param name="BeginDeviceId" value="0" />
<param name="MaxGetCount" value="2" />
<param name="No" value="0" />
<param name="DeviceId" value="1" />
<param name="DeviceSn" value="db00-0030-6602-xxxx" />
<param name="DeviceAlias" value="DWG-16A" />
<param name="DeviceType" value="DWG2000F " />
<param name="MaxPortCount" value="16" />
<param name="AdminStatus" value="ENABLED" />
<param name="RunStatus" value="COMM_FAIL" />
</GetDeviceInfo>
<GetDeviceInfo>
<param name="BeginDeviceId" value="0" />
<param name="MaxGetCount" value="2" />
<param name="No" value="1" />
<param name="DeviceId" value="2" />
<param name="DeviceSn" value="db00-0030-1501-xxxx" />
<param name="DeviceAlias" value="DWG-16B" />
<param name="DeviceType" value="DWG2000B " />
<param name="MaxPortCount" value="16" />
<param name="AdminStatus" value="ENABLED" />
<param name="RunStatus" value="ACTIVE" />
</GetDeviceInfo>
</simsrv>
即可获得预期的搜索结果。
答案 1 :(得分:0)
我找到了答案here,而且很简单。找到存储整个路径的存储,因此您需要在搜索条件上同时使用通配符:
docker@docker1:~$ locate '*jav*.vim'
/usr/share/vim/vim74/autoload/javascriptcomplete.vim
/usr/share/vim/vim74/compiler/javac.vim
/usr/share/vim/vim74/ftplugin/java.vim
当然,您也可以使用正则表达式:
docker@docker1:~$ locate -r 'jav.*.vim'
/usr/share/vim/vim74/autoload/javascriptcomplete.vim
/usr/share/vim/vim74/compiler/javac.vim
/usr/share/vim/vim74/ftplugin/java.vim