Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Solution du tp6

Exo1 :

1. cp /etc/passwd ~
1.1 Grep ‘^$USER’ passwd
ou bien cat passwd | grep "^monnom"

1.2 Grep -i ‘^s’ passwd


1.3 Grep ‘nologin$’
1.4 Grep ‘.us’
2. mkdir ~/essai-grep

cd ~/essai-grep

3. touch tomate poire pomme cerise Fraise fraise courgette POMME3 afraise
4.

Critère 1 ls | grep "^[fF]raise$"

Critère 2 ls | grep "se$"

Critère 3 ls | grep "ai"

Critère 4 ls | grep "[0-9]"

Critère 5 ls | grep "[mM]\{2\}"

Exo2

1. sort passwd > tripassd1.txt


2. cp tripasswd1 tripasswd2
3. sort -m tripasswd1 tripasswd2 > resultat.txt 2>&1
4. sort -u resultat.txt
5. cut -d ‘:’ -f 6 passwd
6. .
6.1 l’ajout
6.2 sort telephone.txt
6.3 wc -l telephone.txt
6.4 grep Sara telephone.txt
6.5 cut -d ‘ ‘ -f 2-3 –output-delimiter=’;’ telephone.txt > res2.txt
7. head -5 /etc/passwd 2> error.txt
tail -5 /etc/passwd 2>> error.txt
8. cat passwd | tr / X
9. uniq passwd
10. diff passwd resultat.txt

You might also like