我们有一个名为的 shell 脚本文件LineFeed.sh
,它执行将 Linefeed( LF
) 转换为 Carriage Return + LineFeed 的功能。我们希望通过 windows 中的批处理文件来完成相同的操作。可能吗?
Linux 外壳文件
E_WRONGARGS=65
cat OutputList|while read -r Line
do
if [ -z "$Line" ]
then
echo "Usage: `basename $0` filename-to-convert"
exit $E_WRONGARGS
fi
NEWFILENAME=$Line.unx
CR='\015' # Carriage return.
# 015 is octal ASCII code for CR.
# Lines in a DOS text file end in CR-LF.
# Lines in a UNIX text file end in LF only.
tr -d $CR < $1 > $NEWFILENAME // here its deleting CR but i need to append LF
# Delete CR's and write to new file.
done
echo "Original DOS text file is \"$1\"."
echo "Converted UNIX text file is \"$NEWFILENAME\"."
exit 0