Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]Jak wyświetlić linię o konkretnym numerze z pliku?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Polskie forum (Polish)
View previous topic :: View next topic  
Author Message
koval_ski
n00b
n00b


Joined: 06 Dec 2005
Posts: 74
Location: Poland, Wrocław

PostPosted: Fri May 25, 2007 7:40 am    Post subject: [SOLVED]Jak wyświetlić linię o konkretnym numerze z pliku Reply with quote

Jak w temacie, a najlepiej żeby wyświetlić kilka linii o wybranych numerach.

Last edited by koval_ski on Fri May 25, 2007 10:29 am; edited 1 time in total
Back to top
View user's profile Send private message
manwe_
l33t
l33t


Joined: 01 Feb 2006
Posts: 632
Location: Kraków/Cracow, Poland

PostPosted: Fri May 25, 2007 8:41 am    Post subject: Reply with quote

Hm. może niezbyt optymalne, ale ja stosuję:
Code:
head -n X PLIK | tail -n 1

X == numer linii. Może da się wykombinować to jednym poleceniem, ale ten sposób działa :wink:
Back to top
View user's profile Send private message
mpapis
n00b
n00b


Joined: 28 Apr 2007
Posts: 45

PostPosted: Fri May 25, 2007 8:52 am    Post subject: Reply with quote

sed '3 p; d' < test.xml

wyswietli 3 linie a reszte skasuje (inaczej 3 linia byla by 2 razy)
_________________
only think what could U do
Back to top
View user's profile Send private message
wirus
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jan 2007
Posts: 93

PostPosted: Fri May 25, 2007 10:11 am    Post subject: Reply with quote

Code:
sed -n -e '1p;6p;10p' jakiś_plik

gdzie: 1p 6p 10p to nr linii które chcesz wyświetlić
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Polskie forum (Polish) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum