>>>>> "Emanuele" == Emanuele Olivetti <olivetti@xxxxxx> writes: Emanuele> C'e' un modo rapido (magari con emacs) per convertire i Emanuele> file di testo formato 'Mac' in un formato umano tipo Emanuele> 'Unix' ? Una cosa cosí? calvin:/tmp> echo 'a\rb' b calvin:/tmp> echo 'a\rb' | tr '\r' '\n' a b calvin:/tmp> Dall'help in linea di Emacs (emacs Visisting): Emacs recognizes from the contents of a file which convention it uses to separate lines--newline (used on GNU/Linux and on Unix), carriage-return linefeed (used on Microsoft systems), or just carriage-return (used on the Macintosh)--and automatically converts the contents to the normal Emacs convention, which is that the newline character separates lines. This is a part of the general feature of coding system conversion (*note Coding Systems::), and makes it possible to edit files imported from various different operating systems with equal convenience. If you change the text and save the file, Emacs performs the inverse conversion, changing newlines back into carriage-return linefeed or just carriage-return if appropriate. Esperimento: 1) in emacs crea un file "unix" con tre righe, ciascuna con una sola lettera (es: a b c), in modo che dia: calvin:/tmp> cat unix a b c calvin:/tmp> od -c unix 0000000 a \n b \n c \n 0000006 calvin:/tmp> 2) nello stesso buffer in cui hai creato il file esegui M-x encode-coding-region rispondi "dos" al prompt e poi scrivi il buffer in un file "dos" 3) riprendi il file "unix" e ripeti encode-coding-region rispondendo "mac", salva il buffer in un file "mac". 4) i tre file dovrebbero risultare così: calvin:/tmp> ls -l unix dos mac -rw-r--r-- 1 manini manini 9 Oct 11 10:50 dos -rw-rw-r-- 1 manini manini 6 Oct 11 10:51 mac -rw-r--r-- 1 manini manini 6 Oct 11 10:50 unix calvin:/tmp> od -c unix 0000000 a \n b \n c \n 0000006 calvin:/tmp> od -c dos 0000000 a \r \n b \r \n c \r \n 0000011 calvin:/tmp> od -c mac 0000000 a \r b \r c \r 0000006 5) adesso puoi provare con "tr": calvin:/tmp> cat mac | tr '\r' '\n' > mac.unix calvin:/tmp> od -c mac.unix 0000000 a \n b \n c \n 0000006 calvin:/tmp> 6) altra prova interessante: calvin:/tmp> file unix dos mac mac.unix unix: ASCII text dos: ASCII text, with CRLF line terminators mac: ASCII text, with CR line terminators mac.unix: ASCII text calvin:/tmp> chiaro no? bye, Luca PS: Morale, Emacs evita di modificare il coding dei file; se era Mac lui te lo fa vedere "giusto", lo puoi modificare, e poi lui lo risalva Mac (ossia giusto). Se poi tu vuoi "dimenticarti" che era Mac e convertirlo in Unix ... basta dirglielo. -- Per iscriversi (o disiscriversi), basta spedire un messaggio con SOGGETTO "subscribe" (o "unsubscribe") a mailto:linuxtrent-request@xxxxxxxxxxxxx