newline problem between DOS and Unix format
I have a bash script file which use SED to replace the version number of a VisualC++ resource file. The SED command looks like:
sed -e 's/FILEVERSION *[0-9]* *, *[0-9]* *, *[0-9]* *, *[0-9]*[ ]*/FILEVERSION $2,$3,$4,$5/g'
After the replacement, I opened the resource file with notepad on my XP computer. I found that all lines are wrapped into a line. However, I opened the same resource file with notepad on my another XP computer, and each line is displayed properly.
Q1. What setting differences on XPs would cause such notepad display difference?
I then added another SED command in the base script
sed -e 's/$/\r/' < "$file1" >| "$file2"
to insert a \r to each line of the replaced resource file.
When I opened the resource file2, I found all lines ending up with a "r" character.
Q2. What is the way to solve the newline problem between dos and unix format properly?