Re: How to do dos2unix for entire directory

2005-11-17 Thread Chris Devers
On Wed, 16 Nov 2005, Bob Showalter wrote:

 Santosh Reddy wrote:
 
  I want to convert all the files which are in dos format to UNIX format.
 
 perl -pi -e 's/\cM$//' *
 
Running this on a directory of image files would be painful :-)

While dos2unix seems like a simple enough utility, modern versions of 
it should have safety features that should prevent it from damaging 
non-text files. Reimplementing it fully  properly in Perl is, while 
certainly doable, a bigger task that it may seem at first glance.

If there's already a utility avilable to do exactly what you want to do, 
why reinvent it? Some assumption that your version of this particular 
wheel will be extra super duper round? Good luck with that... :-) 


-- 
Chris Devers

\Ž?Çfê ¦¸#‚
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response


RE: How to do dos2unix for entire directory

2005-11-16 Thread Timothy Johnson

Check out the File::Find module.  It should come standard with your Perl
distribution.

-Original Message-
From: Santosh Reddy [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 16, 2005 11:02 AM
To: 'Perl Beginners'
Subject: How to do dos2unix for entire directory

Hi All,

 

I want to convert all the files which are in dos format to UNIX format.
We
have the command in UNIX called dos2unix but it takes file as input. But
I
would like give a directory as an argument to the command and it should
convert all the dos files into UNIX format. And it should keep the UNIX
files as it is. In a dos file we have a ^M character at the end of each
line. We have to remove this character. Please send a sample code, if
you
can give full working code that is appreciated.

 

Thanks

Santosh.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: How to do dos2unix for entire directory

2005-11-16 Thread Santosh Reddy
Hi Timothy,

Sorry to ask you but I am very much beginner in Perl. Can you please tell me
how to use this module?
Can you please give an example.

Thanks,
Santosh

-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 17, 2005 12:35 AM
To: Santosh Reddy; Perl Beginners
Subject: RE: How to do dos2unix for entire directory


Check out the File::Find module.  It should come standard with your Perl
distribution.

-Original Message-
From: Santosh Reddy [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 16, 2005 11:02 AM
To: 'Perl Beginners'
Subject: How to do dos2unix for entire directory

Hi All,

 

I want to convert all the files which are in dos format to UNIX format.
We
have the command in UNIX called dos2unix but it takes file as input. But
I
would like give a directory as an argument to the command and it should
convert all the dos files into UNIX format. And it should keep the UNIX
files as it is. In a dos file we have a ^M character at the end of each
line. We have to remove this character. Please send a sample code, if
you
can give full working code that is appreciated.

 

Thanks

Santosh.




___ 
Yahoo! Model Search 2005 - Find the next catwalk superstars - 
http://uk.news.yahoo.com/hot/model-search/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: How to do dos2unix for entire directory

2005-11-16 Thread Bob Showalter

Santosh Reddy wrote:


I want to convert all the files which are in dos format to UNIX format.


perl -pi -e 's/\cM$//' *

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response