Results 1 to 8 of 8
Hi,
I have a script thats been custom made for Windows but i now have a Linux server and iv been told that i need to convert the windows newline ...
- 07-18-2008 #1Just Joined!
- Join Date
- Jul 2008
- Posts
- 4
Perl Script - Windows To Linux
Hi,
I have a script thats been custom made for Windows but i now have a Linux server and iv been told that i need to convert the windows newline to Unix. Iv read a topic on here about a FLIP Binary command that will do this so it will work as at the moment i get a 500 Internal Server Error which im guessing is because its not yet been converted.
Can someone help me install the Flip command onto my server please and tell me where to get it.
This is the thing im talking about http://www.linuxforums.org/forum/133996-post6.html
Thanks
- 07-18-2008 #2
If it's just a matter of converting the Windows ^M characters to UNIX newline characters, you can use dos2unix, which I believe is much more prevalent than flip (I've never heard of flip before).
What kind of UNIX are you using? Knowing that, we can help you install dos2unix (if it's not already installed) and get it to convert your script.
- 07-18-2008 #3Just Joined!
- Join Date
- Jul 2008
- Posts
- 4
Hi,
I have CENTOS Enterprise 5.2 i686 on standard.
I have tried Dos2Unix but nothing happens.
Just found out its not ^M that needs converting as thats not in any of my .pl files.
This is what he said the developer (doesnt do Linux, only Windows, thats why i need a little help):
In Windows, the new line character is actually two characters, \n\r
This is New Line then Return Feed so that the cursor moves back to start of the line on the next line down like a type writer
Unix just uses \n
Windows \n\
You need to ask someone who understands UNIX. Take a look at athis to understand it
ASCII text converstion between UNIX, Macintosh, MS-DOS
There is no point asking me, as I dont understand or work with Unix. All I know is that the file formats are different and need converting. How they are converted or what happens i have no idea. Thats why u need to ask someone who understands Unix
If it were windows, I would have no problem
- 07-18-2008 #4
Have you tried using the flip binary that's on the site you linked to? I don't have a Linux machine available to test it on right now.
- 07-18-2008 #5Just Joined!
- Join Date
- Jul 2008
- Posts
- 4
i dont know how to install it thats the thing

Was hoping someone could maybe help me?
- 07-19-2008 #6Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
Simple perl script to do it
The ^M is a Ctrl-M, ^Z is Ctrl-Z. The script will save the original file with a .bak suffix.Code:#!/usr/bin/perl -pi.bak -w s/[^M^Z]*$//
- 07-19-2008 #7Linux User
- Join Date
- Aug 2006
- Posts
- 458
- 07-19-2008 #8Just Joined!
- Join Date
- Jul 2008
- Posts
- 4


Reply With Quote
