PC Review


Reply
Thread Tools Rate Thread

How to convert CarriageReturns in a text file to Unix style ?

 
 
Wolfgang Hercker
Guest
Posts: n/a
 
      23rd Aug 2006
I am editing a perl script under WinXP/Win2000 with an edtior like NotePad or similar.

I intend to let this Perl script run later under Linux/Solaris/Unix.

Hence I have to convert the Win-Carriage Returns to
Unix compatible line feeds (before uploading it through ftp).

How do I do this conversion ? Is there a tool or command which help me to achieve this ?

Wolfgang

 
Reply With Quote
 
 
 
 
Todd H.
Guest
Posts: n/a
 
      23rd Aug 2006
(E-Mail Removed) (Wolfgang Hercker) writes:

> I am editing a perl script under WinXP/Win2000 with an edtior like NotePad or similar.
>
> I intend to let this Perl script run later under Linux/Solaris/Unix.
>
> Hence I have to convert the Win-Carriage Returns to
> Unix compatible line feeds (before uploading it through ftp).
>
> How do I do this conversion ? Is there a tool or command which help
> me to achieve this ?


dos2unix and unix2dos are teh command line utilities you seek. I
have them installed as part of cygwin (cygwin.com) but i'm not sure
offhand which exact package of cygwin they're in.




$ dos2unix -?
dos2unix version 0.1.3
converts the line endings of text files from
DOS style (0x0d 0x0a) to UNIX style (0x0a)

Usage: dos2unix [OPTION...] [input file list...]

Main options (not all may apply)
-A, --auto Output format will be the opposite of the
autodetected source
format
-D, --u2d Output will be in DOS format
--unix2dos Output will be in DOS format
-U, --d2u Output will be in UNIX format
--dos2unix Output will be in UNIX format
--force Ignore binary file detection
--safe Do not modify binary files

Help options
-?, --help Show this help message
--usage Display brief usage message
--version Display version information
--license Display licensing information

Other arguments
[input file list...] for each file listed, convert in place.
If none specified, then use stdin/stdout



$ unix2dos -?
unix2dos version 0.1.3
converts the line endings of text files from
UNIX style (0x0a) to DOS style (0x0d 0x0a)

Usage: unix2dos [OPTION...] [input file list...]

Main options (not all may apply)
-A, --auto Output format will be the opposite of the
autodetected source
format
-D, --u2d Output will be in DOS format
--unix2dos Output will be in DOS format
-U, --d2u Output will be in UNIX format
--dos2unix Output will be in UNIX format
--force Ignore binary file detection
--safe Do not modify binary files

Help options
-?, --help Show this help message
--usage Display brief usage message
--version Display version information
--license Display licensing information

Other arguments
[input file list...] for each file listed, convert in place.
If none specified, then use stdin/stdout



--
Todd H.
http://www.toddh.net/
 
Reply With Quote
 
Yves Leclerc
Guest
Posts: n/a
 
      23rd Aug 2006
On 23/08/2006 (E-Mail Removed) (Todd H.) wrote:
>(E-Mail Removed) (Wolfgang Hercker) writes:
>
>> I am editing a perl script under WinXP/Win2000 with an edtior like NotePad

or similar.
>>
>> I intend to let this Perl script run later under Linux/Solaris/Unix.
>>
>> Hence I have to convert the Win-Carriage Returns to
>> Unix compatible line feeds (before uploading it through ftp).
>>
>> How do I do this conversion ? Is there a tool or command which help
>> me to achieve this ?

>
>dos2unix and unix2dos are teh command line utilities you seek. I
>have them installed as part of cygwin (cygwin.com) but i'm not sure
>offhand which exact package of cygwin they're in.
>
>
>
>
>$ dos2unix -?
>dos2unix version 0.1.3
> converts the line endings of text files from
> DOS style (0x0d 0x0a) to UNIX style (0x0a)
>
>Usage: dos2unix [OPTION...] [input file list...]
>
>Main options (not all may apply)
> -A, --auto Output format will be the opposite of the
> autodetected source
> format
> -D, --u2d Output will be in DOS format
> --unix2dos Output will be in DOS format
> -U, --d2u Output will be in UNIX format
> --dos2unix Output will be in UNIX format
> --force Ignore binary file detection
> --safe Do not modify binary files
>
>Help options
> -?, --help Show this help message
> --usage Display brief usage message
> --version Display version information
> --license Display licensing information
>
>Other arguments
> [input file list...] for each file listed, convert in place.
> If none specified, then use stdin/stdout
>
>
>
>$ unix2dos -?
>unix2dos version 0.1.3
> converts the line endings of text files from
> UNIX style (0x0a) to DOS style (0x0d 0x0a)
>
>Usage: unix2dos [OPTION...] [input file list...]
>
>Main options (not all may apply)
> -A, --auto Output format will be the opposite of the
> autodetected source
> format
> -D, --u2d Output will be in DOS format
> --unix2dos Output will be in DOS format
> -U, --d2u Output will be in UNIX format
> --dos2unix Output will be in UNIX format
> --force Ignore binary file detection
> --safe Do not modify binary files
>
>Help options
> -?, --help Show this help message
> --usage Display brief usage message
> --version Display version information
> --license Display licensing information
>
>Other arguments
> [input file list...] for each file listed, convert in place.
> If none specified, then use stdin/stdout
>
>
>


If you transfer the TEXT files with the FTP option of ASCII transfer (ascii ),
the the conversion is "supposed" to be done for you automatically.

--
---

Y.

 
Reply With Quote
 
Helge Haensel
Guest
Posts: n/a
 
      24th Aug 2006
Am 23.08.2006, 21:42 Uhr, schrieb Yves Leclerc
<(E-Mail Removed)>:

> On 23/08/2006 (E-Mail Removed) (Todd H.) wrote:
>> (E-Mail Removed) (Wolfgang Hercker) writes:


<... snipped>


Hi, the freeware editor pspad from www.pspad.com has such a switch
in the Format-menue. Highly recommended.
Helge
 
Reply With Quote
 
 
 
Reply

Thread Tools
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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to do a UNIX-style diff between two versions of an Excel file Kilongen Microsoft Excel Misc 3 10th Aug 2009 05:31 PM
What is the easiest way to convert unix/linux text files to DIS/Win text files? Eugen Austermann Windows XP Help 9 22nd Dec 2007 02:22 AM
Downloading unix \n text files, convert to \r\n non-unix? Zytan Microsoft C# .NET 13 7th Apr 2007 02:45 AM
How to convert CarriageReturns in a text file to Unix style ? Wolfgang Hercker Windows XP Help 10 22nd Sep 2006 02:06 AM
How to convert CarriageReturns in a text file to Unix style ? Wolfgang Hercker Windows XP General 3 24th Aug 2006 09:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:40 AM.