2026-01-12 04:07:46 +00:00

24 lines
741 B
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 假设日志文件名为 log.txt执行以下命令
awk '
# 匹配包含 "ML概率:" 但行尾没有数值的行
/ML概率:/ && !/ML概率: [0-9.]+/ {
# 保存当前行
prev_line = $0
# 读取下一行
getline next_line
# 严格判断:下一行是否以 0. 开头0.xx 格式)
if (next_line ~ /^0\./) {
# 合并两行ML概率: 后直接拼接数值
print prev_line next_line
} else {
# 不符合条件,原样输出两行
print prev_line
print next_line
}
# 跳过后续处理
next
}
# 其他行(已完整的行)直接原样输出
1
' output.log >cleaned_log.txt