有人可以建议如果我必须在两个关键字之间阅读时该怎么办吗
*System_Power
1
1.2
1.8
2
*System_Terminate
在这种情况下,asnwer 将是
1
1.2
1.8
2
我尝试像 awk 一样使用
awk '$0 =="*System_Power" # start printing when 1st field is *System_Power
$0 != "*System_Terminate"{ # until reach the *System_Terminate
print; } ' powerSummary > reportedFailure.k # Read from file powerSummary and pipe to reportedFailure.k
exit
上述数据位于文件 powerSummary 中间的某处。
非常感谢您的更正。
最佳答案
这对你有用:
$ awk '/\*System_Power/{f=1;next}/\*System_Terminate/{f=0}f' infile
1
1.2
1.8
2
关于linux - 读取两个关键字之间的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9315513/