views:

1249

answers:

4

Say I have a file with any number of lines, say, 125. I want to get all the lines except the first n, say, 20. So, I want lines 21-125.

Is there a way to do this with with tail/head, or some other tool?

+10  A: 

Try

tail -n +21 myfile.txt
unwind
border case :) Should be +21 for lines from 21 onwards...
Vijay Dev
A: 

Awk power can be used too:

awk -- 'NR > 20' /etc/passwd
Johannes Schaub - litb
+1  A: 

I'm rusty with this but something like: tail -n +20 filename

Rotem
+1  A: 

Try

sed -i 1,20d filename

if you want to delete the first 20 lines !

Vijay Dev