Shell 脚本:合并非句号结尾的句子并断开问号后的换行
#!/bin/bash
获取 t.txt 文件中非句号结尾的句子,并和下一行拼接
awk '{if (substr($0, length($0), 1) != '.') {printf '%s', $0} else {print $0}}' t.txt > temp.txt sed ':a;N;$!ba;s/ / /g' temp.txt > result.txt rm temp.txt
问号前断开换行
sed 's/?\s/?\n/g' result.txt > final.txt rm result.txt
echo '处理完成!'
原文地址: https://www.cveoy.top/t/topic/lXbt 著作权归作者所有。请勿转载和采集!