Unix cat starting from line
What is the best way to output from a file starting from a specific line (big number like 70000). Something like:
cat --line=70000 <file>
Solution 1:
Take a look at tail, more precisecly, it's --lines=+N switch:
tail --lines=+100 <file>
Solution 2:
The most obvious way is tail
. The syntax might be slightly different depending on what OS you are using:
tail -n +70000
If you can not get tail
to work, you could use sed
, but it might end up slower:
sed -pe '1,69999d'
Solution 3:
You can use NR parameter with the awk command:
cat <file> | awk '{if (NR>=7000) print}'