uso de sort

Colapsar
X
 
  • Filtrar
  • Tiempo
  • Mostrar
Limpiar Todo
nuevos mensajes

  • uso de sort

    Buenas, os muestro con un more le contenido del fichero borra.
    Bien, me gustaría ordenar este fichero o bien por el campo1, op por el campo 2 ... dependiendo del momento. Para hacerlo, estoy utilizando el comando "sort",pero no entiendo por que siempre me hace la misma ordenacion. MAs abajo tambien os pongo el resultado

    ayuda please

    # more borra
    3,true,10,10,"CBPSAX-4500",false,false,"V11.01.C04"
    1,true,10,10,"ACPSAX2300-2",false,false,"V11.01.C04"
    2,true,10,10,"VDPSAX-1250",false,false,"V10.00.C07"


    # sort +1 borra
    1,true,10,10,"ACPSAX2300-2",false,false,"V11.01.C04"
    2,true,10,10,"VDPSAX-1250",false,false,"V10.00.C07"
    3,true,10,10,"CBPSAX-4500",false,false,"V11.01.C04"


    # sort +0 borra
    1,true,10,10,"ACPSAX2300-2",false,false,"V11.01.C04"
    2,true,10,10,"VDPSAX-1250",false,false,"V10.00.C07"
    3,true,10,10,"CBPSAX-4500",false,false,"V11.01.C04"


    # sort +2 borra
    1,true,10,10,"ACPSAX2300-2",false,false,"V11.01.C04"
    2,true,10,10,"VDPSAX-1250",false,false,"V10.00.C07"
    3,true,10,10,"CBPSAX-4500",false,false,"V11.01.C04"

    # sort +5 borra
    1,true,10,10,"ACPSAX2300-2",false,false,"V11.01.C04"
    2,true,10,10,"VDPSAX-1250",false,false,"V10.00.C07"
    3,true,10,10,"CBPSAX-4500",false,false,"V11.01.C04"

  • #2
    Re: uso de sort

    En linux existe una cosa llamada manual, que se invoca con el comando: "man".
    Si hubieras hecho "man sort" y hubieras leido el manual (RTFM), hubieras encontrado esto:

    -t separator
    Use character separator as the field separator when finding the
    sort keys in each line. By default, fields are separated by the
    empty string between a non-whitespace character and a whitespace
    character. That is to say, given the input line ` foo bar',
    sort breaks it into fields ` foo' and ` bar'. The field separa-
    tor is not considered to be part of either the field preceding
    or the field following it.
    Editado por última vez por Drazhaz 04-01-07, 12:05:23.
    Linux User #344788 - Proud member since early 2005
    NORMAS del foro - Reglas de Netiqueta - Utilizar correctamente un antivirus
    >> Recomendaciones generales para un óptimo funcionamiento del ordenador <<

    Comentario

    Trabajando...
    X