bash - How to find precise numbers in line and print the line with them?
问题描述
I have a file with table:
1.59 29.206 0.203728775894573 4 60
1.6537 355.592 0.212182437055971 4 0
1.59 29.206 0.203728775894573 3 45
I am trying to print the line with numbers 4 0
.
I tried to use this code.
t=4
v=0
line=$(grep -F "$t" prediction.txt | grep -F "$v")
echo -e $line
解决方案
尝试这个:
awk '$4 == 4 && $5 == 0' prediction.txt
推荐阅读
- java - XG MIDI 信息
- rust - 将 mp3_metadata::Genre 转换为字符串
- html - 尝试在单个 html div 容器上放置 2 个 css 转换的问题
- python - pip 中的解析错误:“'-e git+h'”:预期 W:(abcd...)
- api - 使用 LibAV API 将 mp3 文件转换为 wav (G.711) 文件?
- python - Codewars Buddy Pairs Kata 优化 Python 解决方案
- python - 在 for k in range(...) 语句中引用 a1, a2, ..
- amazon-web-services - 我应该使用 AWS Cognito 客户端凭证进行机器对机器通信吗?
- oracle - 如果输入参数不存在,则使 SQL*Plus 不要求定义输入参数
- python - 为什么在 logging.config.dictConfig(...) 之后日志是空的?