Afficher la derniere ligne d'un fichier
Résolu/Fermé
sambooor
Messages postés
4
Date d'inscription
mercredi 21 mai 2008
Statut
Membre
Dernière intervention
9 juin 2008
-
28 mai 2008 à 16:00
jipicy Messages postés 40842 Date d'inscription jeudi 28 août 2003 Statut Modérateur Dernière intervention 10 août 2020 - 29 mai 2008 à 09:22
jipicy Messages postés 40842 Date d'inscription jeudi 28 août 2003 Statut Modérateur Dernière intervention 10 août 2020 - 29 mai 2008 à 09:22
A voir également:
- Afficher derniere ligne fichier linux
- Fichier rar - Guide
- Comment réduire la taille d'un fichier - Guide
- Comment ouvrir un fichier epub ? - Guide
- Ouvrir fichier .bin - Guide
- Supprimer dernière page word - Guide
2 réponses
jipicy
Messages postés
40842
Date d'inscription
jeudi 28 août 2003
Statut
Modérateur
Dernière intervention
10 août 2020
4 897
28 mai 2008 à 17:54
28 mai 2008 à 17:54
Salut,
awk 'END {print}' fichier;-))
asevere
Messages postés
13087
Date d'inscription
lundi 28 janvier 2002
Statut
Webmaster
Dernière intervention
23 novembre 2024
426
28 mai 2008 à 16:14
28 mai 2008 à 16:14
Bonjour,
awk n'est pas fait pour ça, mais soit:
Sinon, d'autres méthodes (choissez la bonne):
awk n'est pas fait pour ça, mais soit:
awk '{ ligne=$0 } END { print ligne }' ton_fichier.txtPour chaque ligne, l'enregistrer dans la variable ligne, à la fin du traitement, l'afficher.
Sinon, d'autres méthodes (choissez la bonne):
tail -1 ton_fichier.txt tac ton_fichier.txt |head -1 sed -n '$p' etc.
sambooor
Messages postés
4
Date d'inscription
mercredi 21 mai 2008
Statut
Membre
Dernière intervention
9 juin 2008
28 mai 2008 à 17:50
28 mai 2008 à 17:50
merci mon ami, c gentil
28 mai 2008 à 18:02
29 mai 2008 à 09:18
Edit: Sous BSD ça ne passe pas, sous linux si ;)
29 mai 2008 à 09:22
[tmpfs]$ cat asevere Arf, ben j'avais essayé ça dans un premier temps, et je viens de le réessayé à l'instant, ça m'affiche une ligne vide. :-/ Une belette, un lapin !? C'est pas normal! [tmpfs]$ awk 'END { print }' asevere C'est pas normal! [tmpfs]$
Tout est dit ;-))