Last active
September 27, 2016 13:49
-
-
Save Skardian/0c1bb6ed17edcc8c76eb3de2e5d37a74 to your computer and use it in GitHub Desktop.
Revisions
-
Skardian revised this gist
Sep 27, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ sed 's/\(.*\):.*:\(.*\)/\1 \2/g' | # Eliminamos el campo pass # cut -f1,3 -d: | #Nos quedamos con los campos user:UID # tr ':' ' ' | # Cambiamos el ':' por ' ' # ALTERNATIVA 3 # cut -f1,3 -d: --output-delimiter=' ' | #Nos quedamos con los campos 'user UID' uniq -f1 -c -d | # Obtenemos el numero de duplicados sed 's/\(.*\) \(.*\) \(.*\)/\2 \1/' | # Formato <user> <repeticiones> tr -s ' ' | # Comprimimos espacios -
Skardian revised this gist
Sep 27, 2016 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,8 @@ sed 's/\(.*\):.*:\(.*\)/\1 \2/g' | # Eliminamos el campo pass # ALTERNATIVA 2 # cut -f1,3 -d: | #Nos quedamos con los campos user:UID # tr ':' ' ' | # Cambiamos el ':' por ' ' # ALTERNATIVA 3 cut -f1,3 -d: --output-delimiter=' ' | #Nos quedamos con los campos 'user UID' uniq -f1 -c -d | # Obtenemos el numero de duplicados sed 's/\(.*\) \(.*\) \(.*\)/\2 \1/' | # Formato <user> <repeticiones> tr -s ' ' | # Comprimimos espacios -
Skardian created this gist
Sep 27, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/usr/bin/env bash IN=${1:-/etc/passwd} sort -r -k3 -t: -n $IN | # Ordenamos por UID (reverso) # ALTERNATIVA 1 cut -f1-3 -d: | # Nos quedamos con los campos user:pass:UID sed 's/\(.*\):.*:\(.*\)/\1 \2/g' | # Eliminamos el campo pass # ALTERNATIVA 2 # cut -f1,3 -d: | #Nos quedamos con los campos user:UID # tr ':' ' ' | # Cambiamos el ':' por ' ' uniq -f1 -c -d | # Obtenemos el numero de duplicados sed 's/\(.*\) \(.*\) \(.*\)/\2 \1/' | # Formato <user> <repeticiones> tr -s ' ' | # Comprimimos espacios tac # Ordenamos de menor a mayor UID