我试图找到一种方法来列出目录树中的所有文件(递归地),其中包含多个单词。
在搜索时,我找到了<cfset structure1 ={
name = ["john","mary","sue","joe","bob"],
prodID = ["94","62","24","48","64"],
skuID = ["020402","024040","101010","780080","232332"],
distCost = ["34.99","44.99","54.99","64.99","19,99"],
retailCost = ["50","60","70","90","30"],
bv = ["4","5","6","7","8"],
cnt = [#arrayLen(name)#]}
/>
但是|等示例诱导OR。我想和... ...
感谢您的帮助
答案 0 :(得分:2)
将GNU grep
与GNU xargs
一起使用,
grep -ERl 'toto' | xargs -r grep 'tata'
第一个grep
列出包含模式toto
的文件,然后将其提供给xargs
,并使用第二个grep
列出包含tata
的文件。 -r
标记用于确保第二个grep
不会在空输出上运行。
-r
页面xargs
中的man
标记,
-r, --no-run-if-empty
If the standard input does not contain any nonblanks, do not run the command.
Normally, the command is run once even if there is no input. This option is a GNU
extension.
答案 1 :(得分:1)
$service = new Google_Service_Directory($client);
$password = crypt ( "Password", $salt="IamSecretkey" );
$userObj = new Google_Service_Directory_User(
array(
'password' => $password
)
);
try{
$results = $service->users->update("danish@XXXX.in", $userObj );
} catch(Error $ex) {
print_r($ex->getMessage());
}
echo "<pre>";
print_r($results);
工具旨在通过使用提供AND grep:
agrep
在你的情况下,你可以运行
agrep 'pattern1;pattern2' file
PS1:对于当前目录,您只需find . -type f -exec agrep 'toto;tata' {} \; #apply -l to display the file names
PS2:不幸的是agrep不支持-R选项。