Shell 脚本:合并非句号结尾句子并分割逗号
#!/bin/bash
使用sed命令将非句号结尾的句子和下一行拼接
sed -e ':a;N;$!ba;s/([^.])\n/\1 /g' t.txt > t_temp.txt
使用sed命令在逗号前断开换行
sed -e 's/,/\n/g' t_temp.txt > t_final.txt
删除临时文件
rm t_temp.txt
echo '处理完成!'
原文地址: https://www.cveoy.top/t/topic/lW9i 著作权归作者所有。请勿转载和采集!