Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format
PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
utilisateurs:hypathie:tutos:erb-et-ere-par-le-contexte-des-commandes [15/08/2014 07:15] Hypathie [Les expressions rationnelles basiques et les commandes GNU/Linux] |
utilisateurs:hypathie:tutos:erb-et-ere-par-le-contexte-des-commandes [15/08/2014 09:18] Hypathie [Introduction] |
||
---|---|---|---|
Ligne 64: | Ligne 64: | ||
|**''[ ]''** |un caractère cité dans la liste entre crochets |''echo [Tt][io]t[io]''((echo "Toto Tito toto toti tito loto" | echo [Tt][io]t[io]))\\ **affiche les fichiers**\\ Toto\\ Tito\\ toto\\ toti\\ ...\\ **mais pas**\\ loto\\ ... | | |**''[ ]''** |un caractère cité dans la liste entre crochets |''echo [Tt][io]t[io]''((echo "Toto Tito toto toti tito loto" | echo [Tt][io]t[io]))\\ **affiche les fichiers**\\ Toto\\ Tito\\ toto\\ toti\\ ...\\ **mais pas**\\ loto\\ ... | | ||
|**''[ - ]''**\\ [a-z]\\ [A-Z]\\ [A-Z]\\ [0-9] |groupe de caractères |''head t[a-z]to''\\ **affiche**\\ titi\\ tito\\ toto\\ ...\\ **mais pas**\\ tOto\\ t5to\\ | | |**''[ - ]''**\\ [a-z]\\ [A-Z]\\ [A-Z]\\ [0-9] |groupe de caractères |''head t[a-z]to''\\ **affiche**\\ titi\\ tito\\ toto\\ ...\\ **mais pas**\\ tOto\\ t5to\\ | | ||
+ | |||
+ | ===Préparation=== | ||
+ | |||
+ | * Exécuter cette ligne de commande : | ||
+ | <code user> | ||
+ | mkdir ERetCMD/ && cd ERetCMD/ && mkdir Dossier/ &&\ | ||
+ | cd Dossier/ && touch milou && touch tata &&\ | ||
+ | printf "Toto Titi toto titi tito\ndans\n" > titi &&\ | ||
+ | printf "Toto Titi\ndent\n" > titi2 &&\ | ||
+ | printf "toto aime le chocolat\n" > toto &&\ | ||
+ | printf "Toto titi toto tito\n" > Toto.txt &&\ | ||
+ | printf "un copain malin\nmodifiant cette page\n" > tintin &&\ | ||
+ | printf "documentation\n" > titi1 && printf "." > titi1.txt &&\ | ||
+ | printf "Il manque une option a tito\n" > tito &&\ | ||
+ | printf "il a tout mangé.\n" > Toto1.txt | ||
+ | ls | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | milou tintin titi1 titi2 toto Toto.txt | ||
+ | tata titi titi1.txt tito Toto1.txt | ||
+ | </code> | ||
===Métacaractère ou caractère d'expression rationnelle ?=== | ===Métacaractère ou caractère d'expression rationnelle ?=== | ||
Ligne 119: | Ligne 141: | ||
Il s'agit de **find** et **locate**. | Il s'agit de **find** et **locate**. | ||
- | |||
- | ===Péparation=== | ||
- | * créer le répertoire "~/ERetCMD/" et ~/ERetCMD/Dossier: | ||
- | <code user>mkdir ERetCMD/ && cd ERetCMD/ && mkdir Dossier/</code> | ||
- | |||
- | * Créer les fichiers suivants : | ||
- | <code user>cd Dossier/ && touch milou test titi\ | ||
- | titi1 titi2 tito toto. Toto.txt tata tintin titi.\ | ||
- | titi.txt titi1.txt toto Toto1.txt | ||
- | </code> | ||
- | |||
- | * Pour supprimer le répertoire et tout son contenu : | ||
- | (néanmoins, ils serviront pour l'ensemble du wiki) | ||
- | <code>rm -vfR ERetcmd/</code> | ||
=== find=== | === find=== | ||
Ligne 240: | Ligne 248: | ||
Dans le dossier "~/ERetCMD/Dossier" créer les fichiers "smolski-awk.txt" et "smolski-sed.txt": | Dans le dossier "~/ERetCMD/Dossier" créer les fichiers "smolski-awk.txt" et "smolski-sed.txt": | ||
<code user> | <code user> | ||
- | touch smolski-awk.txt && cat >> smolski-sed.txt <<EOF | + | touch smolski-sed.txt && cat >> smolski-sed.txt <<EOF |
toto et titi aiment les abricots. | toto et titi aiment les abricots. | ||
toto préfère les Fraises. | toto préfère les Fraises. | ||
Ligne 248: | Ligne 256: | ||
</code> | </code> | ||
- | <code user>touch smolski-sed.txt && cat >> smolski-awk.txt <<EOF | + | <code user>touch smolski-awk.txt && cat >> smolski-awk.txt <<EOF |
1 3 Nom Genre Age | 1 3 Nom Genre Age | ||
2 1 --------------------------------------- | 2 1 --------------------------------------- |