在txt1
S01A1P2
S01A1P5
S01A1P4
在txt2
data/train/wave/S01A1P3.mfc
data/train/wave/S01A1P7.mfc
data/train/wave/S01A1P8.mfc
data/train/wave/S01A1P1.mfc
data/train/wave/S01A1P5.mfc
data/train/wave/S01A1P6.mfc
data/train/wave/S01A1P2.mfc
data/train/wave/S01A1P4.mfc
使用grep -f txt1 txt2
和结果
data/train/wave/S01A1P4.mfc
但我想要找到所有模式的结果
data/train/wave/S01A1P5.mfc
data/train/wave/S01A1P2.mfc
data/train/wave/S01A1P4.mfc
我该怎么办?
答案 0 :(得分:3)
txt1包含CRLF行终止符。试试这个:
grep -f <(dos2unix <txt1) txt2
答案 1 :(得分:0)
foreach ($json as $jsn) {
foreach($jsn as $j)
{
$date= $j -> date;
$invitee_no = $j -> invitee_no;
$status = $j -> status;
$invitation = new Invitation("",$date,$invitee_no,$status);
$response = $invitation->sendInvite();
var_dump($response);
die();
echo(json_encode($response));
}
}
也适合我。
但你也可以尝试以丑陋的方式去做 -
{"status":-3,"message":"Invitation exists.","invitee_no":"5856"}array(3) {
["status"]=>
int(-3)
["message"]=>
string(18) "Invitation exists."
["invitee_no"]=>
string(4) "5856"
}