informatique:linux:awk
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
informatique:linux:awk [2015/08/28 08:52] – [Les fonctions texte] pteu | informatique:linux:awk [2018/01/07 00:27] – [Exemples] pteu | ||
---|---|---|---|
Line 97: | Line 97: | ||
dude a dude | dude a dude | ||
robert | robert | ||
+ | |||
+ | # puisque l' | ||
+ | # on utilise l' | ||
+ | awk -F: 'BEGIN {printf "%-20s %s\n", " | ||
+ | login: | ||
+ | root root | ||
+ | dude a dude | ||
+ | robert | ||
+ | |||
+ | # on peut même définir un format d' | ||
+ | awk -F: 'BEGIN {format = "%-20s %s\n"; printf format, " | ||
+ | login: | ||
+ | --- --- | ||
+ | root root | ||
+ | dude a dude | ||
+ | robert | ||
+ | |||
+ | # la même commande, en plus lisible : | ||
+ | awk -F: 'BEGIN {format = "%-10s %s\n" | ||
+ | printf format, " | ||
+ | printf format, " | ||
+ | $7 ~ / | ||
</ | </ | ||
+ | |||
====Les fonctions mathématiques==== | ====Les fonctions mathématiques==== | ||
Line 151: | Line 174: | ||
</ | </ | ||
+ | * afficher les blocs de texte du fichier FIC.txt compris entre les balises BEGIN et END : | ||
+ | <code bash> | ||
+ | awk '/ | ||
+ | </ | ||
+ | |||
+ | * supprimer (ne pas afficher) les doublons de lignes dans un fichier : | ||
+ | <code bash> | ||
+ | awk ' | ||
+ | </ |
informatique/linux/awk.txt · Last modified: 2022/04/13 13:03 by pteu