0

I want to write a regex expression to download a file from http. There are many files which reside in my path and has a timestamp associated with it.

For example http://nexus/com-10.0.0.135.527-20150622.210643-1-sources.jar

In the above path, the timestamp is 20150622.210643. I don't know this timestamp before hand, so I want to download all the files from the path which has this kind of timestamp with it.

I wrote a command but it is not working and I am running it through a shell script. I also thought of using wget but i learned wget does not support regex so I went with curl.

curl -O http://nexus/com-10.0.0.135.527-[0-9]{8}+.[0-9]{6}+-1-sources.jar

kindly help me in getting this curl command with regex exp.

1 Answer 1

1

I wrote a command but it is not working

Of course it is not working. cURL expects valid URL as argument and even if yours is syntactically correct it, for obvious reasons points to no existing resource. There's no AI to deal with if for you. If you need additional logic here you need to do it yourself and then pass URL to cURL, otherwise it will simply not work.

You are also using -O option wrong. See cURL docs first.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.