-
BASH > les expressions régulières (regex)
CARACTÈRES
.n’importe quel caractère\bun espace\Walphanumérique\b\W+\bun mot complet\b(toto)\ble mot totoCHOIX
|ou →(toto|titi)→totooutiti[]choix de caractères →t[oi]to→totooutito()→ →POSITION
^début$finRÉPÉTITIONS
*0 ou 1 ou plusieurs fois+au moins 1 fois{3}3 fois exactement{3,}au moins 3 fois{3,5}entre 3 et 5 foisegrep "([0-9]{1,3})"→ chiffre répété 1 à 3 fois →7ou75ou854RÉCUPÉRER UNE OCCURRENCE
Les occurrences limités par des parenthèse
( ), peuvent être rappelés par les symboles\(regex1)bla(regex2)→\1 \2PARTICULARITÉS
avec sed
les caractères
{,},(,),+,?,|doivent être échappés pour être opérationnels.sed "s/[0-9]\{5,\}//g"sed "s/\(toto\)\+//g"EXEMPLES
mots en doublons
(\b\W+\b)\1→\1