SlideShare uma empresa Scribd logo
1 de 10
Linux LPIC1 – Comptia Linux+ noelmace.com
Noël Macé
Formateur et Consultant indépendant expert Unix et FOSS
http://www.noelmace.com
Textprocessing
Commandes GNU & Unix
Licence Creative Commons
Ce(tte) œuvre est mise à disposition selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 3.0 France.
Linux LPIC1 – Comptia Linux+ noelmace.com
Plan
• Combinaison
• Transformation
• Formatage
• Affichage
• Résumer
Linux LPIC1 – Comptia Linux+ noelmace.com
Combinaison
$ cat [options] [fichier(s)...]$ cat [options] [fichier(s)...]
$ join [options] fichier_1 fichier_2$ join [options] fichier_1 fichier_2
$ paste [options] [fichier...]$ paste [options] [fichier...]
• Concaténer des fichiers
• Fusionner les lignes de deux fichiers
• Regrouper les lignes de différents fichiers
Linux LPIC1 – Comptia Linux+ noelmace.com
Transformation
• Convertir les tabulations en espaces
• Convertir les espaces en tabulations
• *
• Trier les lignes d’un fichier texte
• Découper un fichier
$ expand [-t num][fichier...]$ expand [-t num][fichier...]
$ unexpand [-a][fichier...]$ unexpand [-a][fichier...]
$ sort [options] [+POS1 [-POS2]] [fichier...]$ sort [options] [+POS1 [-POS2]] [fichier...]
$ split [options] [fichier_entrée[préfixe_sortie]]$ split [options] [fichier_entrée[préfixe_sortie]]
Linux LPIC1 – Comptia Linux+ noelmace.com
Transformation
• Traduire ou éliminer des caractères
• Convertir les espaces en tabulations
• Éliminer les lignes dupliquées dans un fichier trié
$ tr [options] ENS1 ENS2$ tr [options] ENS1 ENS2
$ uniq [options] [fichier_entrée] [fichier_sortie]$ uniq [options] [fichier_entrée] [fichier_sortie]
Linux LPIC1 – Comptia Linux+ noelmace.com
Formatage
• Mettre en forme des textes
• Numéroter les lignes d’un fichier
$ fmt [options] [fichier...]$ fmt [options] [fichier...]
$ nl [options] [fichier...]$ nl [options] [fichier...]
Linux LPIC1 – Comptia Linux+ noelmace.com
Affichage
• Afficher les premières lignes d'un fichier
• Afficher les dernières lignes d'un fichier
• Afficher un fichier page par page
$ head [options] [fichier...]$ head [options] [fichier...]
$ tail [options] [fichier...]$ tail [options] [fichier...]
$ less [fichier...]$ less [fichier...]
Linux LPIC1 – Comptia Linux+ noelmace.com
Résumer
• Supprimer une partie de chaque ligne d'un fichier.
• Afficher le nombre d'octets, de mots et de lignes d'un fichier
$ cut [options] [fichier...]$ cut [options] [fichier...]
$ wc [options] [fichier...]$ wc [options] [fichier...]
Linux LPIC1 – Comptia Linux+ noelmace.com
Ce qu’on a couvert
• Comment manipuler le texte sous GNU/Linux pour
 combiner des fichiers
 transformer
 formater
 afficher
 et résumer
FIN
Linux LPIC1 – Comptia Linux+ noelmace.com
Licence
Ce(tte) œuvre (y compris ses illustrations, sauf mention explicite) est mise à disposition selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 3.0 France.
Pour voir une copie de cette licence, visitez http://creativecommons.org/licenses/by-nc-sa/3.0/fr/ ou écrivez à :
Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
Vous êtes libre de :
 partager — reproduire, distribuer et communiquer cette œuvre
 remixer — adapter l’œuvre
Selon les conditions suivantes :
 Attribution — Vous devez clairement indiquer que ce document, ou tout document dérivé de celui, est (issu de) l’œuvre
originale de Noël Macé (noelmace.com) (sans suggérer qu'il vous approuve, vous ou votre utilisation de l’œuvre, à moins
d'en demander expressément la permission).
 Pas d’Utilisation Commerciale — Vous n’avez pas le droit d’utiliser cette œuvre à des fins commerciales (ie. l'intention
première ou l'objectif d'obtenir un avantage commercial ou une compensation financière privée). Pour obtenir ce droit, une
autorisation explicite de l'auteur est requise.
 Partage dans les Mêmes Conditions — Si vous modifiez, transformez ou adaptez cette œuvre, vous n’avez le droit de
distribuer votre création que sous une licence identique ou similaire à celle-ci.
Pour toute demande de collaboration, d'utilisation commerciale ou de publication de ce support ou d'un dérivé de celui-ci sous une
licence incompatible, contacter l'auteur via les contacts indiqués sur le site http://www.noelmace.com. Vous êtes par ailleurs
vivement encouragé (sans obligation légale) à communiquer avec celui-ci si vous réalisez une œuvre dérivée ou toute amélioration
de ce support.

Mais conteúdo relacionado

Mais de Noël

LPIC1 10 04 anacron
LPIC1 10 04 anacronLPIC1 10 04 anacron
LPIC1 10 04 anacronNoël
 
LPIC1 10 05 at
LPIC1 10 05 atLPIC1 10 05 at
LPIC1 10 05 atNoël
 
LPIC1 10 03 cron
LPIC1 10 03 cronLPIC1 10 03 cron
LPIC1 10 03 cronNoël
 
LPIC1 10 02 temps
LPIC1 10 02 tempsLPIC1 10 02 temps
LPIC1 10 02 tempsNoël
 
LPIC1 10 01 logs
LPIC1 10 01 logsLPIC1 10 01 logs
LPIC1 10 01 logsNoël
 
LPIC1 09 06 kill
LPIC1 09 06 killLPIC1 09 06 kill
LPIC1 09 06 killNoël
 
LPIC1 09 05 priorités
LPIC1 09 05 prioritésLPIC1 09 05 priorités
LPIC1 09 05 prioritésNoël
 
LPIC1 09 04 bg fg
LPIC1 09 04 bg fgLPIC1 09 04 bg fg
LPIC1 09 04 bg fgNoël
 
LPIC1 09 03 top
LPIC1 09 03 topLPIC1 09 03 top
LPIC1 09 03 topNoël
 
LPIC1 09 02 ps
LPIC1 09 02 psLPIC1 09 02 ps
LPIC1 09 02 psNoël
 
LPIC1 09 01 intro
LPIC1 09 01 introLPIC1 09 01 intro
LPIC1 09 01 introNoël
 
LPIC1 08 05 runlevels
LPIC1 08 05 runlevelsLPIC1 08 05 runlevels
LPIC1 08 05 runlevelsNoël
 
LPIC1 08 03 grub2
LPIC1 08 03 grub2LPIC1 08 03 grub2
LPIC1 08 03 grub2Noël
 
LPIC1 08 02 grub legacy
LPIC1 08 02 grub legacyLPIC1 08 02 grub legacy
LPIC1 08 02 grub legacyNoël
 
LPIC1 08 01 démarrage
LPIC1 08 01 démarrageLPIC1 08 01 démarrage
LPIC1 08 01 démarrageNoël
 
LPIC1 07 14 mount
LPIC1 07 14 mountLPIC1 07 14 mount
LPIC1 07 14 mountNoël
 
LPIC1 07 13 fsck
LPIC1 07 13 fsckLPIC1 07 13 fsck
LPIC1 07 13 fsckNoël
 
LPIC1 07 18 debugfs
LPIC1 07 18 debugfsLPIC1 07 18 debugfs
LPIC1 07 18 debugfsNoël
 
LPIC1 07 17 tune2fs
LPIC1 07 17 tune2fsLPIC1 07 17 tune2fs
LPIC1 07 17 tune2fsNoël
 
LPIC1 07 16 dumpe2fs
LPIC1 07 16 dumpe2fsLPIC1 07 16 dumpe2fs
LPIC1 07 16 dumpe2fsNoël
 

Mais de Noël (20)

LPIC1 10 04 anacron
LPIC1 10 04 anacronLPIC1 10 04 anacron
LPIC1 10 04 anacron
 
LPIC1 10 05 at
LPIC1 10 05 atLPIC1 10 05 at
LPIC1 10 05 at
 
LPIC1 10 03 cron
LPIC1 10 03 cronLPIC1 10 03 cron
LPIC1 10 03 cron
 
LPIC1 10 02 temps
LPIC1 10 02 tempsLPIC1 10 02 temps
LPIC1 10 02 temps
 
LPIC1 10 01 logs
LPIC1 10 01 logsLPIC1 10 01 logs
LPIC1 10 01 logs
 
LPIC1 09 06 kill
LPIC1 09 06 killLPIC1 09 06 kill
LPIC1 09 06 kill
 
LPIC1 09 05 priorités
LPIC1 09 05 prioritésLPIC1 09 05 priorités
LPIC1 09 05 priorités
 
LPIC1 09 04 bg fg
LPIC1 09 04 bg fgLPIC1 09 04 bg fg
LPIC1 09 04 bg fg
 
LPIC1 09 03 top
LPIC1 09 03 topLPIC1 09 03 top
LPIC1 09 03 top
 
LPIC1 09 02 ps
LPIC1 09 02 psLPIC1 09 02 ps
LPIC1 09 02 ps
 
LPIC1 09 01 intro
LPIC1 09 01 introLPIC1 09 01 intro
LPIC1 09 01 intro
 
LPIC1 08 05 runlevels
LPIC1 08 05 runlevelsLPIC1 08 05 runlevels
LPIC1 08 05 runlevels
 
LPIC1 08 03 grub2
LPIC1 08 03 grub2LPIC1 08 03 grub2
LPIC1 08 03 grub2
 
LPIC1 08 02 grub legacy
LPIC1 08 02 grub legacyLPIC1 08 02 grub legacy
LPIC1 08 02 grub legacy
 
LPIC1 08 01 démarrage
LPIC1 08 01 démarrageLPIC1 08 01 démarrage
LPIC1 08 01 démarrage
 
LPIC1 07 14 mount
LPIC1 07 14 mountLPIC1 07 14 mount
LPIC1 07 14 mount
 
LPIC1 07 13 fsck
LPIC1 07 13 fsckLPIC1 07 13 fsck
LPIC1 07 13 fsck
 
LPIC1 07 18 debugfs
LPIC1 07 18 debugfsLPIC1 07 18 debugfs
LPIC1 07 18 debugfs
 
LPIC1 07 17 tune2fs
LPIC1 07 17 tune2fsLPIC1 07 17 tune2fs
LPIC1 07 17 tune2fs
 
LPIC1 07 16 dumpe2fs
LPIC1 07 16 dumpe2fsLPIC1 07 16 dumpe2fs
LPIC1 07 16 dumpe2fs
 

LPIC1 02 12 textprocessing

  • 1. Linux LPIC1 – Comptia Linux+ noelmace.com Noël Macé Formateur et Consultant indépendant expert Unix et FOSS http://www.noelmace.com Textprocessing Commandes GNU & Unix Licence Creative Commons Ce(tte) œuvre est mise à disposition selon les termes de la Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 3.0 France.
  • 2. Linux LPIC1 – Comptia Linux+ noelmace.com Plan • Combinaison • Transformation • Formatage • Affichage • Résumer
  • 3. Linux LPIC1 – Comptia Linux+ noelmace.com Combinaison $ cat [options] [fichier(s)...]$ cat [options] [fichier(s)...] $ join [options] fichier_1 fichier_2$ join [options] fichier_1 fichier_2 $ paste [options] [fichier...]$ paste [options] [fichier...] • Concaténer des fichiers • Fusionner les lignes de deux fichiers • Regrouper les lignes de différents fichiers
  • 4. Linux LPIC1 – Comptia Linux+ noelmace.com Transformation • Convertir les tabulations en espaces • Convertir les espaces en tabulations • * • Trier les lignes d’un fichier texte • Découper un fichier $ expand [-t num][fichier...]$ expand [-t num][fichier...] $ unexpand [-a][fichier...]$ unexpand [-a][fichier...] $ sort [options] [+POS1 [-POS2]] [fichier...]$ sort [options] [+POS1 [-POS2]] [fichier...] $ split [options] [fichier_entrée[préfixe_sortie]]$ split [options] [fichier_entrée[préfixe_sortie]]
  • 5. Linux LPIC1 – Comptia Linux+ noelmace.com Transformation • Traduire ou éliminer des caractères • Convertir les espaces en tabulations • Éliminer les lignes dupliquées dans un fichier trié $ tr [options] ENS1 ENS2$ tr [options] ENS1 ENS2 $ uniq [options] [fichier_entrée] [fichier_sortie]$ uniq [options] [fichier_entrée] [fichier_sortie]
  • 6. Linux LPIC1 – Comptia Linux+ noelmace.com Formatage • Mettre en forme des textes • Numéroter les lignes d’un fichier $ fmt [options] [fichier...]$ fmt [options] [fichier...] $ nl [options] [fichier...]$ nl [options] [fichier...]
  • 7. Linux LPIC1 – Comptia Linux+ noelmace.com Affichage • Afficher les premières lignes d'un fichier • Afficher les dernières lignes d'un fichier • Afficher un fichier page par page $ head [options] [fichier...]$ head [options] [fichier...] $ tail [options] [fichier...]$ tail [options] [fichier...] $ less [fichier...]$ less [fichier...]
  • 8. Linux LPIC1 – Comptia Linux+ noelmace.com Résumer • Supprimer une partie de chaque ligne d'un fichier. • Afficher le nombre d'octets, de mots et de lignes d'un fichier $ cut [options] [fichier...]$ cut [options] [fichier...] $ wc [options] [fichier...]$ wc [options] [fichier...]
  • 9. Linux LPIC1 – Comptia Linux+ noelmace.com Ce qu’on a couvert • Comment manipuler le texte sous GNU/Linux pour  combiner des fichiers  transformer  formater  afficher  et résumer FIN
  • 10. Linux LPIC1 – Comptia Linux+ noelmace.com Licence Ce(tte) œuvre (y compris ses illustrations, sauf mention explicite) est mise à disposition selon les termes de la Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 3.0 France. Pour voir une copie de cette licence, visitez http://creativecommons.org/licenses/by-nc-sa/3.0/fr/ ou écrivez à : Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. Vous êtes libre de :  partager — reproduire, distribuer et communiquer cette œuvre  remixer — adapter l’œuvre Selon les conditions suivantes :  Attribution — Vous devez clairement indiquer que ce document, ou tout document dérivé de celui, est (issu de) l’œuvre originale de Noël Macé (noelmace.com) (sans suggérer qu'il vous approuve, vous ou votre utilisation de l’œuvre, à moins d'en demander expressément la permission).  Pas d’Utilisation Commerciale — Vous n’avez pas le droit d’utiliser cette œuvre à des fins commerciales (ie. l'intention première ou l'objectif d'obtenir un avantage commercial ou une compensation financière privée). Pour obtenir ce droit, une autorisation explicite de l'auteur est requise.  Partage dans les Mêmes Conditions — Si vous modifiez, transformez ou adaptez cette œuvre, vous n’avez le droit de distribuer votre création que sous une licence identique ou similaire à celle-ci. Pour toute demande de collaboration, d'utilisation commerciale ou de publication de ce support ou d'un dérivé de celui-ci sous une licence incompatible, contacter l'auteur via les contacts indiqués sur le site http://www.noelmace.com. Vous êtes par ailleurs vivement encouragé (sans obligation légale) à communiquer avec celui-ci si vous réalisez une œuvre dérivée ou toute amélioration de ce support.