Shell 脚本:合并句子并处理逗号
#!/bin/bash
Step 1: 合并非句号结尾的句子
sed -e ':a' -e '/.$/{N;s/\n/ /;ta}' t.txt > temp.txt
Step 2: 在逗号前断开换行
sed -i -e ':a' -e '/[^,],$/{N;s/\n/ /;ta}' temp.txt
清理临时文件
mv temp.txt t.txt
echo 'Done!'
原文地址: https://www.cveoy.top/t/topic/lW9z 著作权归作者所有。请勿转载和采集!