具有如下所示的文件夹结构 ./all_files
-rwxrwxrwx reference_file.txt
drwxrwxrwx file1.txt
drwxrwxrwx file2.txt
drwxrwxrwx file3.txt
reference_file.txt的文件名如下所示
file1.txt
file2.txt
file1.txt和file2.txt中的数据如下所示:
step_1 第2步 step_3
现在,我必须从每个文件中采取特定步骤说出step2
注1:文件名必须出现在reference_file.txt
中注2:step2不是第二行:
注3:搜索应该递归执行。
我使用过以下脚本:
#!/bin/sh
while read f; do
find . -type f -name "${f}" | xargs grep -l -F 'step_2'
done <reference_file.txt
#!/bin/sh
for i in reference_file.txt
做
找到。 -type f -name“$ {f}”| xargs grep -l -F'step_2'
完成了
请帮助我。
答案 0 :(得分:0)
删除-l选项对我有用。
import UIKit
class ViewController: UIViewController {
var expression = FacialExpression(eyes: .Closed, eyeBrows: .Normal, mouth: .Smile) {
didSet {
updateUI()
}
}
@IBOutlet weak var faceView: FaceView!{
didSet{
faceView.addGestureRecognizer(UIPinchGestureRecognizer(
target: faceView, action: Selector(FaceView.changeScale(_:))
))
updateUI()
}
}
private var mouthCurvatures = [FacialExpression.Mouth.Frown:-1.0,.Grin: 0.5,.Smile:1.0,.Smirk: -0.5,.Neutral: 0.0 ]
private var eyeBrowTilts = [FacialExpression.EyeBrows.Relaxed:0.5,.Furrowed:-0.5,.Normal:0.0]
private func updateUI(){
switch expression.eyes {
case .Open: faceView.eyesOpen = true
case .Closed: faceView.eyesOpen = false
case .Squinting: faceView.eyesOpen = false
}
faceView.mouthCurvature = mouthCurvatures[expression.mouth] ?? 0.0
faceView.eyeBrowTilt = eyeBrowTilts[expression.eyeBrows] ?? 0.0
}
}
cat reference_file.txt for f in
我可以看到它也是递归工作的。当我从; do find . -type f -name $f | xargs grep 'step_2' ; done
(由我创建的目录结构)
dir1
如果递归问题仍然存在,请分享目录结构和文件名等更多信息。