I am using
curl to grab the HTML of a website. I want to only grab the first 20 lines, and save this in an external file. I need to grab about 10 URLs, and want to save all of them in the same file. Preferably with the URL of each file above the results. What I came up with is:
curl http://example.com/url1 | head -20 && curl http://example.com/url2 | head -20 > exportfile
However, this yields two issues:
- This only saves the latest page (and if I put > exportfile after every statement, it overvwrites the file
- This does not save the actual command in the file
Any way to make this work as I intend?