IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Ubuntu Discussion :

[UBUNTU] Utilisation de dos2unix


Sujet :

Ubuntu

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre Expert
    Avatar de hiko-seijuro
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    2 011
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 2 011
    Par défaut [UBUNTU] Utilisation de dos2unix
    bonjour

    j'ai un petit pb avec ubuntu 5.10 : j'ai bien installer le paquetages sysutils seulement dès que j'essaie de taper la commande suivate
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    dos2unix -n update update.unix
    ile me dit que l'option -n n'existe pas
    de plus dans le man il me parle d'un fromdos et d'un todos

    ccomment cela se faisse et comment je dois faire

  2. #2
    Membre émérite

    Profil pro
    Inscrit en
    Août 2003
    Messages
    878
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2003
    Messages : 878
    Par défaut
    Que disent
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    dos2unix --help
    man dos2unix
    ???

  3. #3
    Membre Expert
    Avatar de hiko-seijuro
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    2 011
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 2 011
    Par défaut
    ca me dit ca :

    tofrodos(1) tofrodos(1)



    NAME
    tofrodos - Converts text files between DOS and Unix formats.

    SYNOPSIS
    fromdos [ options ] [file...]
    todos [ options ] [file...]

    DESCRIPTION
    DOS text files traditionally have carriage return and line feed pairs
    as their newline characters while Unix text files have the line feed as
    their newline character. fromdos converts text files from the DOS for‐
    mat to the Unix format, while todos converts text files from the Unix
    format to the DOS format.

    The programs accept multiple filenames and wildcards as their argu‐
    ments. You may also use them in a pipe. If either program finds its
    input redirected, it will process stdin and place the output on stdout.

    OPTIONS
    -a Always convert. If converting from DOS to Unix, this option will
    cause the program to remove ALL carriage returns. The default is
    to remove carriage returns only if they are followed by line
    feeds. If converting from Unix to DOS, this option will cause
    the program to convert ALL linefeeds to carriage return pairs.
    The default is to convert linefeeds only if they are not already
    preceeded by a carriage return.

    -b Make a backup of original file. The original file is renamed
    with the original filename and a .bak extension.

    -d Convert from DOS to Unix. This forces the program to convert the
    file in a particular direction. By default, if the program is
    named fromdos or dos2unix, it will assume that the input file is
    in a DOS format and convert it to a Unix format. If the program
    is named todos or unix2dos, it will assume that the input file
    is in a Unix format and convert it to a DOS format. Using the -d
    option forces the program to convert from a DOS format to a Unix
    format regardless of how the program is named. Likewise, using
    the -u option forces the program to convert from a Unix format
    to a DOS format regardless of the name of the program.

    -e Abort processing on any error in any file. Normally, the program
    will simply skip to process the next file on the command line
    when it encounters any errors. This option causes it to abort on
    errors.

    -f Force: convert even if the file is not writeable (read-only). By
    default, if fromdos or todos finds that the file does not have
    write permission, it will not process that file. This option
    forces the conversion even if the file is read-only.

    -h Display a short help screen on the program usage and quit.

    -o Overwrite the original file (no backup). This is the default.

    -p Preserve file ownership and time. On systems like Linux, the
    file ownership will only be preserved if the user is root, oth‐
    erwise it will just set the file time and silently fail the
    change of file ownership. If you want a warning message when the
    file ownership cannot be changed, use -v.

    -u Convert from DOS to Unix. See the -d option above for more
    information.

    -v Verbose.

    -V Show version message and quit.

    AUTHOR
    The program and its documentation are copyrighted (c) 1996-1999 by
    Christopher S L Heng. All rights reserved. They are distributed under
    the terms of the GNU General Public License Version 2.

    Email address
    chrisheng@bigfoot.com
    cyfheng@singnet.com.sg


    Primary site (Singapore)
    http://chrisheng.cjb.net/
    http://web.singnet.com.sg/~cslheng/


    Primary mirror (USA)
    http://chrisheng.hypermart.net/



    1999 Version 1.4 tofrodos(1)

  4. #4
    Invité4
    Invité(e)
    Par défaut
    tu vois que l'option -n n'est pas dans le man.
    Etudie-le et regarde quelle autre option utiliser.

  5. #5
    Membre Expert
    Avatar de hiko-seijuro
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    2 011
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 2 011
    Par défaut
    k mici

  6. #6
    Membre émérite

    Profil pro
    Inscrit en
    Août 2003
    Messages
    878
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2003
    Messages : 878
    Par défaut
    Pas testé, mais tu peux faire un truc comme ça...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    #!/bin/bash
    # File : dos2unixn.sh
    # Author : David.Schris
    # Goal : convert text file ($1) from DOS to unix format and save the converted file as specified ($2)
    if [ $# -ne 2 ] ; then
    {
        echo "Usage: $0 <sourceFile> <destFile>" >&2
        exit 1
    }
    fi
    dos2unix -b $1 || { echo "$0: dos2unix failed" >&2 ; exit 1 ; }
    mv "$1" "$2" && mv "$1.bak" "$1" || { echo "$0: mv failed" >&2 ; exit 1 ; }

  7. #7
    Membre émérite
    Avatar de Pouic
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    669
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Octobre 2004
    Messages : 669
    Par défaut
    Mmm, un tr fait tout aussi bien l'affaire...
    Software becomes slower faster than hardware becomes faster
    [size=1]
    http://xrenault.developpez.com

  8. #8
    Membre émérite

    Profil pro
    Inscrit en
    Août 2003
    Messages
    878
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2003
    Messages : 878
    Par défaut
    Comment ?

  9. #9
    Membre émérite
    Avatar de Pouic
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    669
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Octobre 2004
    Messages : 669
    Par défaut
    Citation Envoyé par David.Schris
    Comment ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    cat format_dos | tr "\r" " " > format_unix
    De toute façon, moi, j'ai mis ces deux fonctions dans mon .emacs, et du coup, j'ai juste à éditer le fichier en question et appeler ces fonctions ;-)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    (defun dos2unix ()
      (interactive)
      (goto-char (point-min))
      (while (search-forward "\r" nil t)
        (replace-match "")))
     
    (defun unix2dos ()
      (interactive)
      (goto-char (point-min))
      (while (search-forward "\n" nil t)
        (replace-match "\r\n")))
    Software becomes slower faster than hardware becomes faster
    [size=1]
    http://xrenault.developpez.com

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Créer sur Ubuntu, utiliser sur Windows
    Par nour_al_imen dans le forum Débuter
    Réponses: 5
    Dernier message: 08/05/2011, 16h18
  2. [UBUNTU] Utilisation de LMMS
    Par DavidDeTroyes dans le forum Ubuntu
    Réponses: 2
    Dernier message: 14/05/2007, 11h12
  3. [UBUNTU] Utilisation du logiciel Draw
    Par rayga dans le forum Ubuntu
    Réponses: 2
    Dernier message: 05/05/2007, 06h30
  4. [UBUNTU] Est-il possible d'utiliser cdshell ?
    Par shintoisme dans le forum Ubuntu
    Réponses: 1
    Dernier message: 18/08/2006, 00h19
  5. Réponses: 14
    Dernier message: 14/03/2006, 15h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo