Академический Документы
Профессиональный Документы
Культура Документы
grep:
^ (Caret) = match expression at the start of a line, as in ^A.
$ (Question) = match expression at the end of a line, as in A$.
\ (Back
= turn off the special meaning of the next character, as in \^.
Slash)
[] match any one of the enclosed characters, as in [aeiou]. Use Hyphen "-" for a range,
=
(Brackets) as in [0-9].
[^ ] = match any one character except those enclosed in [ ], as in [^0-9].
. (Period) = match a single character of any value, except end of line.
* (Asterisk) = match zero or more of the preceding character or expression.
\{x,y\} = match x to y occurrences of the preceding.
\{x\} = match exactly x occurrences of the preceding.
\{x,\} = match x or more occurrences of the preceding.
-Chercher les lignes qui ne contiennent QUE des chiffres (ne contiennent pas
de caractères)
-Chercher tout les utilisateurs qui ont « sh » comme shell par defaut
-Chercher les lignes commençant par une lettre et dont le deuxième caractère
est un chiffre
sort
-Ordonner les lignes par ordre alphabétique croissant
sort /home/esprit/test
Head/tail
-Extraire les 4 premières lignes a partir du début du ficher
Head -4 /home/esprit/test
Head –n 4 /home/esprit/test
Head –c 4 /home/esprit/test
Head -n -2 /home/esprit/test
Tail –n -4 /home/esprit/test
Tail -4 /home/esprit/test
Cut
-Extraire les 4 premiers caractère de chaque ligne
cut –d « : » -f 3 /home/esprit/test
Tr
-Remplacer les caractères minuscules en majuscule