Skip to content

Instantly share code, notes, and snippets.

@sroccaserra
Last active May 9, 2019 21:05
Show Gist options
  • Select an option

  • Save sroccaserra/0e234b03b599a611b3a3e9449806ed48 to your computer and use it in GitHub Desktop.

Select an option

Save sroccaserra/0e234b03b599a611b3a3e9449806ed48 to your computer and use it in GitHub Desktop.
Utilisation de awk pour faire une visualisation

Voir aussi : http://www.grymoire.com/Unix/Awk.html

awk '{ if($2=="POST") { dot="."} else { dot="X" } if ($1 != ass) { print ass, dots; ass=$1; dots=""; } else { dots=dots""dot; } } END { print ass, dots }'

Pour agréger des lignes comme ça

451776 PATCH
451776 PATCH
456559 PATCH
456559 PATCH
456559 PATCH
456559 PATCH
456559 POST

En ça :

451776 ..
451737 ................
453426 ....
453316 ......
456559 ....X
456361 ........
456262 .......X............
456672 .......
456226 ..................

Filtrer les Urls de stdout et les télécharger

À partir de cette sortie :

$ scalingo -a api-production la
To:   Thu May 9 18:08:21 +0000 UTC 2019
From: Thu May 9 15:17:05 +0000 UTC 2019
Size: 6461022
Url:  https://xxxxxxxxxxxxxxxxx
-------
To:   Thu May 9 15:17:04 +0000 UTC 2019
From: Thu May 9 14:16:36 +0000 UTC 2019
Size: 9873836
Url:  https://xxxxxxxxxxxxxxxxx
-------

Récupérer les urls et les passer à xargs :

scalingo -a api-production la | awk '/Url:/{print "-JO",$2}' | xargs curl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment