Commande équivalent à Sed, awk, tail,head en powershell !

Fermé
hackmed Messages postés 6 Date d'inscription lundi 11 mai 2015 Statut Membre Dernière intervention 21 mai 2015 - 18 mai 2015 à 14:16
zipe31 Messages postés 36402 Date d'inscription dimanche 7 novembre 2010 Statut Contributeur Dernière intervention 27 janvier 2021 - 18 mai 2015 à 17:46
Bonjour,

Je fais un script shell qui doit extraire une suite de chiffre.

Voici un exemple ou je chercher a obtenir le chiffre :
S-1-5-21-2266954777-2911002515-1883294743
comme résultat.
la commande est :
PS C:\Users\HACKMED\Searches\Pictures\Documents\script> whoami /ALL

Résultat:

PS C: \ Users \ HACKMED \ Searches \ Pictures \ Documents \ script> whoami / ALL

User Information
------------------------

Username SID
================== ================================ ==============
hackmed-pc \ hackmed S-1-5-21-2266954777-2911002515-1883294743-1000

1 réponse

zipe31 Messages postés 36402 Date d'inscription dimanche 7 novembre 2010 Statut Contributeur Dernière intervention 27 janvier 2021 6 407
18 mai 2015 à 17:46
Salut,

$ cat plop 
PS C: \ Users \ HACKMED \ Searches \ Pictures \ Documents \ script> whoami / ALL

User Information
------------------------

Username SID
================== ================================ ==============
hackmed-pc \ hackmed S-1-5-21-2266954777-2911002515-1883294743-1000


$ awk 'END  { print $NF }' plop 
S-1-5-21-2266954777-2911002515-1883294743-1000

0