How to capture Curl output to a file?

前端 未结 7 1086
小蘑菇
小蘑菇 2020-12-12 08:57

I have a text document that contains a bunch of URLs in this format:

URL = \"sitehere.com\"

What I\'m looking to do is to run curl -K

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-12 09:06

    There are several options to make curl output to a file

     # saves it to myfile.txt
    curl http://www.example.com/data.txt -o myfile.txt
    
    # The #1 will get substituted with the url, so the filename contains the url
    curl http://www.example.com/data.txt -o "file_#1.txt" 
    
    # saves to data.txt, the filename extracted from the URL
    curl http://www.example.com/data.txt -O 
    
    # saves to filename determined by the Content-Disposition header sent by the server.
    curl http://www.example.com/data.txt -O -J 
    

提交回复
热议问题