This shows you the differences between two versions of the page.
— |
informatica:linux:crlf [2017/02/10 12:16] (current) javi created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== CRLF ====== | ||
+ | |||
+ | CR LF Retorno de carro EOL end of line | ||
+ | |||
+ | https://www.cyberciti.biz/faq/howto-unix-linux-convert-dos-newlines-cr-lf-unix-text-format/ | ||
+ | |||
+ | En DOS el final de linea suele ser un Carriage Return (CR) y un Line Feed (LF), mientras que en Unix es tan solo un Line Feed (LF). | ||
+ | |||
+ | ===== Comprobar si un archivo tiene CRLF ===== | ||
+ | |||
+ | Comando: | ||
+ | |||
+ | file metabox-class.php | grep ASCII | ||
+ | |||
+ | En caso de que **SI** tenga CRLF la salida será: | ||
+ | |||
+ | metabox-class.php: PHP script, ASCII text, with CRLF line terminators | ||
+ | |||
+ | En caso de que **NO** tenga CRLF la salida será: | ||
+ | |||
+ | metabox-class.php: PHP script, ASCII text | ||
+ | |||
+ | ===== Reemplazar CRLF por LF ===== | ||
+ | |||
+ | 1. Instalar paquete: | ||
+ | |||
+ | sudo aptitude install dos2unix | ||
+ | | ||
+ | 2. Ejecutar: | ||
+ | |||
+ | dos2unix metabox-class.php | ||
+ | | ||
+ | 3. Comprobar: | ||
+ | |||
+ | file metabox-class.php | grep ASCII | ||
+ | |||
+ | Salida esperada: | ||
+ | |||
+ | metabox-class.php: PHP script, ASCII text | ||