The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
DOS/Windows CR to a UNIX LF 17 MB text file tex Windows & DOS: Issues & Discussions 9 05-21-2008 09:31 PM
Opening a Unix File in Windows. a439511 UNIX for Dummies Questions & Answers 6 03-07-2008 02:13 AM
How send a file from UNIX to Windows with FTP edzela Shell Programming and Scripting 1 08-28-2006 06:20 AM
ftp file from Windows to Unix automatically whatisthis Shell Programming and Scripting 4 11-14-2005 11:55 AM
FILE MANAGEMENT in WINDOWS & UNIX farazcis UNIX for Dummies Questions & Answers 1 06-09-2005 08:27 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-11-2003
Registered User
 

Join Date: Dec 2003
Location: bangalore, india
Posts: 22
windows file to unix :end line chararcter

hi ,

When i ftp a text file from Windows to unix enviornment and open the file in " vi editor" the end line charcrter of the windows file is seen as "cntrl+M" charcter in the Unix enviornment.

Is there any command in unix , so that i dont see this "cntrl+M"
chararcter in the Unix vi editor.

Thanx,
Reply With Quote
Forum Sponsor
  #2  
Old 12-11-2003
Registered User
 

Join Date: Dec 2003
Location: India
Posts: 50
"dos2unix"
and
"unix2dos" can be used to convert the files from dos to unix and vice versa using unix2dos

You can get it from web for free
Cheers
JK
Reply With Quote
  #3  
Old 12-11-2003
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,477
Re: windows file to unix :end line chararcter

Quote:
Originally posted by dharmesht
When i ftp a text file from Windows to unix enviornment
Or even more simply, you transfer your text files in FTP ASCII mode.
Reply With Quote
  #4  
Old 12-11-2003
Registered User
 

Join Date: Dec 2003
Location: bangalore, india
Posts: 22
hi,
in the Vi editor it still shows me the cntrl+M characters for the end- line ,
after using the dos2unix command ....
Is there any command by which the cntrl+M in vi editor can be made invisible........
Reply With Quote
  #5  
Old 12-11-2003
Registered User
 

Join Date: Dec 2003
Location: India
Posts: 50
Well there is one utility called flip (option -u to remove the ^M)

flip -u filename

that will remove the ^M, but I don' t know whether this is supported by all.

As for the dos2unix is concerned it will just put the output to the console, you can redirect it to some junk file or the same file.

dos2unix filename > junk.txt
mv junk.txt filename

Cheers
JK
Reply With Quote
  #6  
Old 12-11-2003
Registered User
 

Join Date: Dec 2003
Location: bangalore, india
Posts: 22
hi jaya,
My unix is solaris 5.8 , it doesnt support " flip " caoomand i guess . But its fine when i trasfer the file in
"ASCII" mode i get the file w/o cntrl+M characters ...
So the problem is solved...
Cheers,
Dharmesh
Reply With Quote
  #7  
Old 12-11-2003
davidg's Avatar
Registered User
 

Join Date: Jul 2003
Location: Holland
Posts: 207
Hi Dharmesh,

Still if you will ever find a file that contains the CTRL + m characters there is a very easy way to get rid of them. They have been mention many times here on the forums.

The way to do this is to open the file using vi. Stay in Escape mode and type the following :

:1,$s/<CTRL>+v <CTRL>+m//g

<ctrl>+v says that the next character is a special character. This will be substituted with nothing. i.o.w. removed
:1,$ just says from line number 1 until the end.

Regs David
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
crlf, dos2unix

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 02:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0