#1 Le 04/12/2007, à 18:51
- jerepain
cut : comment couper un retour chariot ?
Bonsoir,
J'ai un fichier qui contient N lignes, et je veux afficher sur la sortie standard l'avant-dernière.
Pour afficher les 2 dernières, je fais tail -n2 ../mon_fichier, mais ensuite j'aimerais couper la dernière.
C'est tout bête, mais je sais pas comment on fait
#2 Le 04/12/2007, à 18:55
- Link31
Re : cut : comment couper un retour chariot ?
tail -n2 ../ton_fichier | head -n1
Dernière modification par Link31 (Le 04/12/2007, à 18:55)
Hors ligne
#3 Le 05/12/2007, à 08:05
- Gari
Re : cut : comment couper un retour chariot ?
Ca n'a ni queue ni tête tout ça
(désolé ).
Hors ligne
#4 Le 05/12/2007, à 09:55
- Alain.g
Re : cut : comment couper un retour chariot ?
Pour obtenir l'avant-dernière ligne avec sed :
sed '$!{h;d;};x' fichier.txt
d'après sed1line
Dernière modification par Alain.g (Le 05/12/2007, à 10:00)
Xubuntu Karmic !
Hors ligne