JDE876
JDE876

Reputation: 407

unix split skip first n of lines

I have a rather large file I need to split. However, I don't need the first 1000 lines. I would like to start the split at line 1001 and then continue to split the file by 1000. I know how to split by 1000, that is no problem.

CODE:

split --lines=1000 *.txt

However, I want to skip the first 1000 lines. Is there any way to do this?

Upvotes: 2

Views: 5754

Answers (2)

Praveen
Praveen

Reputation: 902

@JDE876 : We can even get the desired output using perl one liner

perl -ne "print if $. > 1000" file

Upvotes: 0

falsetru
falsetru

Reputation: 369334

Use tail -n +1001 to get lines starting from 1001st line:

cat *.txt | tail -n +1001 | split --lines=1000

Upvotes: 7

Related Questions