I've searched all over the web but couldn't find anything useful for this. Using CURL, I want to append content to a file which is already existing and named as test.pls
. Can anyone please tell me how can I do it using curl. The commands I've tried are
curl http://192.99.8.170:8098/stream --output test.pls
curl -K --output test.pls http://192.99.8.170:8098/stream
curl -a --output test.pls http://192.99.8.170:8098/stream
But all of above starts creating files from scratch.They don't keep the initial content of file Can anyone please help me!
Use the shell's appending output redirection ( >> ) rather than curl's --output option.
Like in: curl http://{one,two}.site.com -o "file_#1. txt" or use several variables like: curl http://{site,host}.host[1-5].com -o "#1_#2" You may use this option as many times as the number of URLs you have. See also the --create-dirs option to create the local directories dynamically.
cURL commands can download files from a remote location. You can do it in two different ways: -O will save the file in the current working directory with the same file name as remote. -o lets you specify a different file name or location.
Consequentially, the file will be saved in the current working directory. If you want the file saved in a different directory, make sure you change current working directory before you invoke curl with the -O, --remote-name flag! There is no URL decoding done on the file name.
Use the shell's appending output redirection (>>
) rather than curl's --output
option.
curl http://192.99.8.170:8098/stream >> test.pls
A much easier and cleaner way is as follows:
curl -sS https://address.to.file.txt >> file-name.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With