Shell 脚本:合并非句号结尾的句子并替换问号
#!/bin/bash
获取 t.txt 文件中非句号结尾的句子,并和下一行拼接
cat t.txt | awk '{if($0 !~ /[.!?]$/) {getline nextline; print $0 nextline} else print $0}'
在输出结果中将问号替换为换行符
| tr '?' '\n'
原文地址: http://www.cveoy.top/t/topic/lXcU 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
#!/bin/bash
cat t.txt | awk '{if($0 !~ /[.!?]$/) {getline nextline; print $0 nextline} else print $0}'
| tr '?' '\n'
原文地址: http://www.cveoy.top/t/topic/lXcU 著作权归作者所有。请勿转载和采集!