The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Compiling scripts written in Unix coburn Shell Programming and Scripting 1 11-09-2006 11:17 PM
How can I run scripts in my unix account from batch file in Windows? olgafb UNIX for Dummies Questions & Answers 7 05-27-2006 09:40 AM
Run the scripts from windows to UNIX srinivas peyyal Shell Programming and Scripting 3 03-29-2005 08:11 AM
FTP Shell Scripts from Windows to Unix: files have exotic characters Laud12345 Shell Programming and Scripting 4 02-17-2005 05:57 PM
checking the size of unix cd on windows platform johnjsm Windows & DOS: Issues & Discussions 2 12-09-2004 05:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-09-2002
tamilselvi tamilselvi is offline
Registered User
  
 

Join Date: Sep 2002
Posts: 3
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 (permalink)  
Old 09-09-2002
janr janr is offline
Registered User
  
 

Join Date: Jun 2002
Location: Amsterdam (Netherlands)
Posts: 142
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
there was a strange character(^M) been added automatically in UNIX
  #3 (permalink)  
Old 09-09-2002
tamilselvi tamilselvi is offline
Registered User
  
 

Join Date: Sep 2002
Posts: 3
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 (permalink)  
Old 09-10-2002
bigkevmcd bigkevmcd is offline
Registered User
  
 

Join Date: Aug 2002
Posts: 3
> 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 (permalink)  
Old 09-11-2002
tamilselvi tamilselvi is offline
Registered User
  
 

Join Date: Sep 2002
Posts: 3
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 (permalink)  
Old 10-02-2002
Brett Brett is offline
Registered User
  
 

Join Date: Sep 2002
Location: Hitchin, England
Posts: 7
... 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 (permalink)  
Old 10-02-2002
WIntellect's Avatar
WIntellect WIntellect is offline
Registered User
  
 

Join Date: Sep 2002
Location: United Kingdom
Posts: 170
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

I love Perl!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0