How to find n'th row from UNIX file?

Hello Gurus,

I am new to this forum and I have a BASIC knowlege in UNIX commands. I have a data file which contains 1 billion records, how to find 5678th row and put this rows into a new file? Can anybody please give the command how to do this?

awk 'NR==5678{print;exit}' file1 > file2

Does this mean that you have a text file with one billion lines and you want to extract line number 5678? If so, you can use sed. The normal answer would be something like:
sed -n 5678p < datafile

But I'm pretty sure that sed will read the file to the end. It will take time to read and discard those 999994322 lines. So to speed things up, use:

sed -n '5678p;5679q' < datafile

or:
sed '5678q;d' datafile