Herramientas de usuario

Herramientas del sitio


proyectos:linuxservidor-shell-bash

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
proyectos:linuxservidor-shell-bash [2020/01/18 18:58] manuel.floresvproyectos:linuxservidor-shell-bash [2024/04/09 23:14] (actual) manuel.floresv
Línea 1: Línea 1:
 +<code bash>
 +sort -t, -nk3 user.csv
 +</code>
 +donde:
 +  * //-t//, - define que el delimitador es la ,.
 +  * //-n// - brinda el ordenamiento numerico. 
 +  * //-k3// - define que columna usará para ordenamiento.
 +
 +
 +<code bash>
 +manuel@lapanda:~/tmp$ cat prueba2.txt
 +a,3,r,t
 +d,5,d,d
 +t,7,f,g
 +u,3,g,w
 +v,9,x,k
 +p,0,k,l
 +q,1,p,h
 +manuel@lapanda:~/tmp$ sort -t, -nk2 prueba2.txt | cut -d, -f1,2, | tr  , " "
 +p 0 l
 +q 1 h
 +a 3 t
 +u 3 w
 +d 5 d
 +t 7 g
 +v 9 k
 +manuel@lapanda:~/tmp$ sort -t, -nk2 prueba2.txt | cut -d, -f1,3, | tr  , " "
 +p k l
 +q p h
 +a r t
 +u g w
 +d d d
 +t f g
 +v x k
 +manuel@lapanda:~/tmp$ cat gtthan.txt 
 +12:sdaa:adasr:fdsfr
 +123:perpore:asdnassd:asdasd
 +34:74:okoasd:urur:rrp
 +128:popas:rera:fosa
 +45:bosla:miosna:xiooan
 +37:woajs:losala:huasmd
 +100:bfluasd:zoiorewr:ojuidf
 +manuel@lapanda:~/tmp$ cat gtthan.txt |sort -t: -k3| awk -F: '{print $0}'
 +12:sdaa:adasr:fdsfr
 +123:perpore:asdnassd:asdasd
 +37:woajs:losala:huasmd
 +45:bosla:miosna:xiooan
 +34:74:okoasd:urur:rrp
 +128:popas:rera:fosa
 +100:bfluasd:zoiorewr:ojuidf
 +manuel@lapanda:~/tmp$ cat gtthan.txt |sort -t: -k3| awk -F: '{if ($1 > 100) print $0}'
 +123:perpore:asdnassd:asdasd
 +128:popas:rera:fosa
 +manuel@lapanda:~/tmp$ cat gtthan.txt |sort -t: -k3| awk -F: '{if ($1 > 100) print $0}' >pp.txt
 +manuel@lapanda:~/tmp$ cat pp.txt 
 +123:perpore:asdnassd:asdasd
 +128:popas:rera:fosa
 +
 +</code>
 +
 <code> <code>
  % Cortar del final  % Cortar del final
Línea 14: Línea 74:
 echo ${images##*.} echo ${images##*.}
 echo ${images%.*} echo ${images%.*}
 +echo $images |rev
  
 I="cn=lisa,dc=example,dc=com" I="cn=lisa,dc=example,dc=com"
Línea 24: Línea 85:
 echo ${RenX} echo ${RenX}
 echo ${RenY} echo ${RenY}
 +
 +
 </code> </code>
 ====== Referencias ====== ====== Referencias ======
Línea 30: Línea 93:
   * https://devhints.io/bash   * https://devhints.io/bash
   * https://www.linuxjournal.com/content/bash-brace-expansion   * https://www.linuxjournal.com/content/bash-brace-expansion
 +  * https://www.lifewire.com/test-linux-command-unix-command-4097166
 +  * https://stackoverflow.com/questions/17048188/how-to-use-awk-sort-by-column-3
 +  * https://linuxhint.com/bash_tr_command/
 +  * https://stackoverflow.com/questions/13690461/using-cut-command-to-remove-multiple-columns
 +  * https://riptutorial.com/bash/example/31704/sort-by-keys
proyectos/linuxservidor-shell-bash.1579373918.txt.gz · Última modificación: por manuel.floresv