Shell 脚本:合并句子并分割逗号
#!/bin/bash
1. 将 t.txt 文件中非句号结尾的句子与下一行拼接
sed -e ':a' -e 'N' -e '$!ba' -e 's/([^。])\n([^ ])/\1\2/g' t.txt |
2. 若逗号不在结尾,在逗号前断开换行内容
sed 's/([^,]),/\1, /g'
原文地址: https://www.cveoy.top/t/topic/lW9u 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
#!/bin/bash
sed -e ':a' -e 'N' -e '$!ba' -e 's/([^。])\n([^ ])/\1\2/g' t.txt |
sed 's/([^,]),/\1, /g'
原文地址: https://www.cveoy.top/t/topic/lW9u 著作权归作者所有。请勿转载和采集!