batch file + convert LF to CR+LF

后端 未结 2 831
日久生厌
日久生厌 2020-12-18 08:00

We have a shell script file named LineFeed.sh which does a function of converting a Linefeed(LF) to Carriage Return + LineFeed. We want the same to

2条回答
  •  独厮守ぢ
    2020-12-18 08:18

    You can find one way on this Wikipedia page:

    TYPE unix_file | FIND "" /V > dos_file
    

    Remember that you can't redirect the output to the same file you're reading from. This applies to pretty much all systems and shells, so an additional rename is necessary.

    The key here is that type knows how to read LF line endings and find will then convert them do CRLF. type alone won't do anything with the output (it's supposed to, because having a command that simply dumps the file contents messing with them isn't good :-)).

提交回复
热议问题