Problem: text that can be normally wrapped in Linux will not be wrapped in windows.
When changing a line in windows, there are two characters: Carriage Return (/R) and line feed (/N ). But in Linux, there is only one line feed (/N)
You can use unix2dos and dos2unix commands to convert the format:
Parameters:
-K: The timestamp of the output file and input file remains unchanged.
-O default file mode. Convert the file and output it to file
-N new infile OUTFILE mode. Convert infile and output it to OUTFILE
1.Unix2dos
Assume that you use VI to create a text file and enter 123456
[Root @ centos test] #Ls-l a.txt
-RW-r -- 1 Root 7 Jan 7 21:31 a.txt
[Root @ centos test] #Hexdump-C a.txt
0000000 1 2 3 4 5 6/n
0000007
[Root @ centos test] #Unix2dos-N a.txt B .txt
Unix2dos: Converting file a.txt to file B .txt in DOS format...
[Root @ centos test] #Ls-l
Total 8
-RW-r -- 1 Root 7 Jan 7 21:31 a.txt
-RW ------- 1 Root 8 Jan 7 21:34 B .txt
[Root @ centos test] #Hexdump-C a.txt
0000000 1 2 3 4 5 6/n
0000007
[Root @ centos test] #Hexdump-C B .txt
0000000 1 2 3 4 5 6/R/n
0000008
B .txt is a converted DOS file.
2.Dos2unix
[Root @ centos test] #Dos2unix-N B .txt c.txt
Dos2unix: Converting file B .txt to file c.txt in UNIX format...
[Root @ centos test] #Ls-l
Total 12
-RW-r -- 1 Root 7 Jan 7 21:31 a.txt
-RW ------- 1 Root 8 Jan 7 21:34 B .txt
-RW ------- 1 Root 7 Jan 7 21:38 c.txt
[Root @ centos test] #Hexdump-C B .txt
0000000 1 2 3 4 5 6/R/n
0000008
[Root @ centos test] #Hexdump-C c.txt
0000000 1 2 3 4 5 6/n
0000007
C.txt is a converted UNIX text file.