答案1
尝试以下任一方法:
awk -vORS= '{print sub(/\r$/,"") ? $0" " : $0"\n"}' < infile > outfile
awk 'ORS = sub(/\r$/,"") ? " " : "\n"' < infile > outfile
perl -pe 's/\r\n/ /' < infile > outfile
或就地:
perl -pe 's/\r\n/ /' -i file
尝试以下任一方法:
awk -vORS= '{print sub(/\r$/,"") ? $0" " : $0"\n"}' < infile > outfile
awk 'ORS = sub(/\r$/,"") ? " " : "\n"' < infile > outfile
perl -pe 's/\r\n/ /' < infile > outfile
或就地:
perl -pe 's/\r\n/ /' -i file