Paul - The Programmer

simple & stupid
Detect file format is dos or unix
Setup a Linux PyS60 development environment

Convert file format from dos to unix

paul posted @ Fri, 25 Feb 2011 08:55:11 +0800 in coding life with tags file format Perl sed vim , 4120 readers

Convert file format by sed

$cp you-file-name your-file-name.bak
$sed 's/^M//g' your-file-name.bak > your-file-name

Covert file format by Perl

$perl -i.bak -pe 's/^M//g;'  your-file-name

Covert file format by vim

:setlocal ff=unix
:wq

 

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter