写出脚本 ash1 ttxt 文件中非句号结尾的句子和下一行拼接2 问号前断开换行
#!/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/\n/ /g' temp.txt > result.txt rm temp.txt
问号前断开换行
sed 's/?\s/?\n/g' result.txt > final.txt rm result.txt
echo "处理完成!"
原文地址: http://www.cveoy.top/t/topic/GKM 著作权归作者所有。请勿转载和采集!