Den 19-01-2011 13:23, Bjarne Jensen skrev:
> Jeg fandt denne stump et sted på nettet
>
> # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format
> awk '{sub(/\r$/,"");print}' # assumes EACH line ends with Ctrl-M
>
> Den er testet OK på kommandolinien så jeg skrev sådan i et php script:
>
Det er måske lettere at få dette til at virke?
---8<--------------------------------
The suite of utilities known as DosUnix provide a selection of features
allowing manipulation of text files in a mixed DOS/Windows and Unix
environment.
The three utilities are:
- dosunix, which creates a copy of a DOS text file in Unix text format;
- unixdos, which creates a copy of a Unix text file in DOS text format;
- chktxt, which inspects a given text file to determine whether it is in
DOS text format or Unix text format.
WWW:
http://dosunix.sourceforge.net/
---8<--------------------------------
Eller
tofrodos - Converts DOS <-> Unix text files, alias tofromdos
DOS text files traditionally have CR/LF (carriage return/line feed)
pairs as their new line delimiters while Unix text files traditionally
have LFs (line feeds) to
terminate each line.
Tofrodos comprises one program, "fromdos" alias "todos", which converts
text files to and from these formats. Use "fromdos" to convert DOS text
files to the Unix format,
and "todos" to convert Unix text files to the DOS format.
This functionality is also available via the dos2unix/unix2dos symlinks.
---8<----
Leif