Ask Bjoern Hansen writes ..

>On Fri, 27 Apr 2001, Billy Joedono wrote:
>
>[...]
>> Convert to regular Unix format and problem solved! More 
>question: how can I 
>> force vi to show these, or better yet, how can I get 
>dos2unix or unix2dos 
>> in Linux?
>
>perl -i -pe 's/\r\n/\n/' file_to_be_converted_to_unix_lines.txt
>perl -i -pe 's/\n/\r\n/' file_to_be_converted_to_dos_lines.txt


that's platform dependant code - it will not work on systems like Win32 that
do line-ending conversion on text files

specifically in the substitution from "\n" to "\r\n" when Win32 writes that
out to a file it will replace the "\n" with "\r\n" so you'll get "\r\r\n" at
the end of each line

believe it or not - you need to do some bindmoding of filehandles to ensure
no line-ending conversion is done .. it's not a one-liner

-- 
  jason king

  In Norway, you may not spay your female dog or cat.  However, you may
  neuter the males of the species. - http://dumblaws.com/

Reply via email to