Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search by line num 6

Status
Not open for further replies.

bhas1

Programmer
Mar 17, 2007
4
US
I've a big file with 6million xml format records, I want see the line num 1022887 , what is the unix command i should be using? any help is greatly appriciated
Thanks
BK
 
Thanks feherke that did the trick!!
 
Just for perfomance boost:
sed -n '1022887{;p;q;}' /input/file
# or
awk 'NR==1022887{print;exit}' /input/file

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Depending on your envrionment, you may want to test out:
Code:
head -n 1022887 /input/file | tail -n 1

PHV's sed method with quit works about twice a fast in my 8 cpu HP-UX environment.

But on my Intel-32 Centrino-M laptop with Linux the head/tail method works about on order of magnitude faster.

Cheers,
ND [smile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top