1

I am trying to get the 400th line of source code from a number of web pages via the terminal. So far, the only way I have been able to do this is by downloading the entire source code from the page (using cURL) and then extracting the line I want, but that takes a long time when iterating over lots of pages.

Is there a way to do this more efficiently, and just get a certain line of the source code from the beginning? Is there something like cURL's head -n function, except for individual lines?

Frick Steves
  • 327
  • 2
  • 11

1 Answers1

2

You could do

curl -s "$url" | head -n400 | tail -n1
mfnalex
  • 635
  • 3
  • 15