diff --git a/pages.fr/common/awk.md b/pages.fr/common/awk.md index 7f9207f322..7c8cd26fbb 100644 --- a/pages.fr/common/awk.md +++ b/pages.fr/common/awk.md @@ -26,3 +26,11 @@ - Affiche une ligne sur trois en partant de la première ligne : `awk 'NR%3==1' {{nom_de_fichier}}` + +- Affiche les lignes dont la valeur de la colone 10 vaut la valeur recherchée : + +`awk '($10 == valeur)'` + +- Affiche les lignes dont la valeur de la colone 10 est comprise entre un min et un max : + +`awk '($10 >= valeur_min && $10 <= valeur_max)'` diff --git a/pages/common/awk.md b/pages/common/awk.md index a2a715d06b..36171167c5 100644 --- a/pages/common/awk.md +++ b/pages/common/awk.md @@ -19,18 +19,18 @@ `awk '{s+=$1} END {print s}' {{filename}}` -- Sum the values in the first column and pretty-print the values and then the total: - -`awk '{s+=$1; print $1} END {print "--------"; print s}' {{filename}}` - - Print every third line starting from the first line: `awk 'NR%3==1' {{filename}}` -- Print all values starting from the third column: - -`awk '{for (i=3; i <= NF; i++) printf $i""FS; print""}' {{filename}}` - - Print different values based on conditions: `awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print "Partial match bar"; else print "Baz"}' {{filename}}` + +- Print all lines where the 10th column value equals the specified value : + +`awk '($10 == value)'` + +- Print all the lines which the 10th column value is between a min and a max : + +`awk '($10 >= min_value && $10 <= max_value)'`