tech:notes_sed_grep_regex
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_sed_grep_regex [2025/04/01 16:09] – Jean-Baptiste | tech:notes_sed_grep_regex [2025/12/15 16:21] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 7: | Ligne 7: | ||
| Voir : | Voir : | ||
| + | * `man regex` | ||
| * [[grep avec option p comme AIX - Récupérer un paragraphe complet]] | * [[grep avec option p comme AIX - Récupérer un paragraphe complet]] | ||
| + | Voir aussi : | ||
| + | * pcregrep | ||
| ## Regex | ## Regex | ||
| Ligne 17: | Ligne 19: | ||
| ^((? | ^((? | ||
| ~~~ | ~~~ | ||
| + | |||
| + | |||
| + | Grepper sur plusieurs lignes (match grep with line break) | ||
| + | ~~~bash | ||
| + | grep -zP ' | ||
| + | ~~~ | ||
| + | |||
| ### Extended regular expressions | ### Extended regular expressions | ||
| Ligne 37: | Ligne 46: | ||
| becomes ‘(abc*)\1’ when using extended regular expressions. Backreferences must still be escaped when using extended regular expressions. | becomes ‘(abc*)\1’ when using extended regular expressions. Backreferences must still be escaped when using extended regular expressions. | ||
| ~~~ | ~~~ | ||
| + | |||
| + | Trouver des tabulations dans un fichier (GNU grep) you can use the Perl-style regexp | ||
| + | ~~~bash | ||
| + | grep -P ' | ||
| + | ~~~ | ||
| + | |||
| ### Pb | ### Pb | ||
| - | #### Pb Binary | + | #### Pb binary |
| Ligne 174: | Ligne 189: | ||
| Voir : | Voir : | ||
| * https:// | * https:// | ||
| + | |||
| + | Utiliser les variables d' | ||
| + | ~~~bash | ||
| + | awk -v a=" | ||
| + | ~~~ | ||
| Dernier champ ; avant dernier champ | Dernier champ ; avant dernier champ | ||
| Ligne 250: | Ligne 270: | ||
| calc_sum() { awk ' | calc_sum() { awk ' | ||
| + | ~~~ | ||
| + | |||
| + | ### Awk autres | ||
| + | |||
| + | ''/ | ||
| + | ~~~bash | ||
| + | # ......... | ||
| + | $SMBCLIENT -gNL $key 2>/ | ||
| + | BEGIN { ORS=""; | ||
| + | / | ||
| + | if (first) | ||
| + | print opts; first=0 | ||
| + | dir = $2 | ||
| + | loc = $2 | ||
| + | # Enclose mount dir and location in quotes | ||
| + | # Double quote " | ||
| + | gsub(/\$$/, " | ||
| + | print " \\\n\t \"/" | ||
| + | } | ||
| + | END { if (!first) print " | ||
| + | ' | ||
| ~~~ | ~~~ | ||
tech/notes_sed_grep_regex.1743516582.txt.gz · Dernière modification : de Jean-Baptiste
