On Windows with notepadd++ edit a shell script, die or die, back to Linux, edit, or have this \ r, search the next, is this:
http://bluemood.blog.51cto.com/1142811/1030925
‘
because the shell processed the character file in Windows, the string that was supposed to output two lines became a line, and some characters from the beginning of the first line were overwritten by the second line.
This is due to the difference between the/R ^m characters under Windows and Linux, which can filter out the exception characters and then output: as sed ' s/[^0-9,.:a-za-z]//g ' filters out characters that do not conform to the rules
Reproduced below can be referenced below:
In the UNIX system, the end of each line is only "< line >", or "\ n", and in the Windows system, each line ends with "< newline >< Enter >", or "\n\r". As a direct result, when files in the UNIX system are opened in Windows, all the text becomes a line, and the files in Windows are opened under UNIX, which may have a ^m symbol at the end of each line.
Okay, so my problem is that there are ^m symbols at the end of each line of the file that is being processed, and that's usually not visible. Can be viewed with the "cat-a test.file" command. When I want to add a character at the end of a line, it is always added at the beginning of the line and overwrites the character at the beginning of the line.
There are two ways to convert a file:
1. Command Dos2unix test.file
2. Remove the "\ r" and use the command sed-i "s/\r//" "Test.file
OK, so deal with the punishment, OK ...