Visit Our UNIX and Linux User Community


Porting of Windows written unix scripts to unix platform


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Porting of Windows written unix scripts to unix platform
# 1  
Old 09-09-2002
Question Porting of Windows written unix scripts to unix platform

Can anybody help me in finding out a solution for the problem below?

When we write .unix or .sh files in windows OS and port them to Unix platforms there is a character ^M inserted at the end of each line of the script file.

During ftp porting I set the transfer mode as ASCII for the script files where I ported files individually.Then there is no such problem.

But when we go for folder transfer where the folder has the script files dumped the problem comes again where the space is inserted with ^M at the end of lines...

Please help me in sorting out this soon..

Thanks in Advance.
# 2  
Old 09-09-2002
look for ...

Hi,

Most UNIX types have a util called like 'dos2unix'.

those utilities remove the ^M from the end of line.

In DOS/MS the line end with <cr><lf>, UNIX only uses <lf>, this is the reason for it.

it also possible do it with vi or sed, see next thread for more information
https://www.unix.com/showthread.php?s...light=linefeed
# 3  
Old 09-09-2002
Question

Thanks for your answers.

Let me explain my actual problem in detail.

We developed a product in windows and prepared installers both for windows and unix OS.The project files contains some unix scripts for the application to run on Unix OS.

So when we run the installer and install the product in Unix OS , the unix script files which get installed pertaining to the application have this ^M at the end of the lines.

So how to rectify the problem.

The solution you gave solves the problem in individual file porting.

But how about for the installer files and installer?


Please send me a solution.

Thanks in Advance
# 4  
Old 09-10-2002
> We developed a product in windows and prepared installers
> both for windows and unix OS.The project files contains some
> unix scripts for the application to run on Unix OS.

> So when we run the installer and install the product in Unix
> OS , the unix script files which get installed pertaining to the
> application have this ^M at the end of the lines.

The obvious solution to the problem is to use an Editor that's capable of writing out Unix compatible files.

Probably the best commercial one for Windows users is TextPad http://www.textpad.com.

HTH

Kevin
# 5  
Old 09-11-2002
Question

Hi

Thanks fro your reply.

But we used only textpad to write the unix scripts.

I donot know what is the exact solution for the problem


Thanks
Tamilselvi
# 6  
Old 10-02-2002
... did you solve this ?

... if not, how are you porting the files from the windows platform to UNIX ? Some FTP clients will take care of this problem in the transfer - I think CuteFTP is one of them. www.cuteftp.com

If not come back and we'll try something else....
# 7  
Old 10-02-2002
Here's one that was shown to me; on the unix box, run this perl 1 liner from the command line - replace "dos.file" with the file to be converted from dos to unix:

perl -i -pne 's/\r\n/\n/g' dos.file

the file will then be UNIX usable

Smilie I love Perl! Smilie

Previous Thread | Next Thread
Test Your Knowledge in Computers #367
Difficulty: Medium
The Single UNIX Specification specifies vi, so every conforming UNIX system must have it.
True or False?

10 More Discussions You Might Find Interesting

1. Programming

Unix File has 000 access when written

Good day! I would just like to ask about an issue I encountered. There is a Java program (version1.3) that we use that is hosted in Unix (HP-UX B.11.11 U), and one of its functions copies a file and writes it to another directory. It usually runs fine, but one day, it wrote a file that had 000... (2 Replies)
Discussion started by: mike_s_6
2 Replies

2. AIX

how to allow Windows platform to access Unix based disk volumes

How to allow Windows platform to access Unix(AIX) based disk volumes? (2 Replies)
Discussion started by: rainbow_bean
2 Replies

3. UNIX for Dummies Questions & Answers

Exporting Files from Unix to a Windows Platform

I was able to convert my csv file in Unix to xls. I would like to export the converted xls file to a windows environment. I have to manually connect using the following below: ftp: 192.x.x.x -> username/pass -> cd -> mget *.xls and then confirm. Could I automate this process into a shell... (4 Replies)
Discussion started by: ravzter
4 Replies

4. Shell Programming and Scripting

Compiling scripts written in Unix

I would like to convert some Unix scripts into machine language. I dont know how to programe in C. Is there any software out there that I can use to convert these Unix scripts into machine language. Thanks. (1 Reply)
Discussion started by: coburn
1 Replies

5. UNIX for Dummies Questions & Answers

How can I run scripts in my unix account from batch file in Windows?

Hi all, I'm working on Windows, connecting to my Unix account by different ways: by FTP opening files in UltraEdit32, by mapping drive to browse, by Exceed or Telnet to compile at Unix account. Actually, that is what I would like to change: I'd like to make a batch file which would connect to... (7 Replies)
Discussion started by: olgafb
7 Replies

6. UNIX for Dummies Questions & Answers

porting programs with dcom to unix

Hi I have a rather large set of sas programs that i want to port to unix sas. All of these programs uses windows functionality somehow. For example win API calls and ole-dll:s via com and dcom. Now my company is moving to sas on unix, and we must port these apps (sas macros). So what Im... (3 Replies)
Discussion started by: iommi
3 Replies

7. Shell Programming and Scripting

Run the scripts from windows to UNIX

HI, I have one java program in windows OS. From that java program, I want to run the shell script file in the UNIX OS. Is it possible ??If yes, please post me the source code, how to do that ?? Thanks, Srinivas (3 Replies)
Discussion started by: srinivas peyyal
3 Replies

8. Shell Programming and Scripting

FTP Shell Scripts from Windows to Unix: files have exotic characters

Hey guys, I am working on my shell scripts in wordpad in windows. Then, I upload it to my unix using psftp, but when I open those files with "vi" in Unix, there are all these "^M" characters in the file. Would anyone of you have a clue as to why? Help would be appreciated. Thanks, Laud (4 Replies)
Discussion started by: Laud12345
4 Replies

9. Windows & DOS: Issues & Discussions

checking the size of unix cd on windows platform

Hi, Is it possible or is there a program out there that can get the byte size of a unix cd on the windows platform. Any help would be really great with this. Thanks (2 Replies)
Discussion started by: johnjsm
2 Replies

10. Programming

I am porting Dll from NT to Unix, how should I proceed

I am porting Dll from Windows NT to Unix, Could any body pls guide me how should I proceed?? (3 Replies)
Discussion started by: Vipin
3 Replies

Featured Tech Videos