Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to get the latest uploaded path from curl output? Post 303044922 by manas_ranjan on Monday 9th of March 2020 05:57:53 AM
Old 03-09-2020
How to get the latest uploaded path from curl output?

I'm able to download the file successfully using the following curl command.
Code:
curl -u  ${UserName}:${Password}  -k ${URL} -o ~/response.txt

Example of directory contents and filenames from response.txt is
Code:
<a href="2.0.0-SNAPSHOT/">2.0.0-SNAPSHOT/</a>      05-Mar-2020 11:13    -
<a href="5.0.0-SNAPSHOT/">5.0.0-SNAPSHOT/</a>      06-Feb-2020 13:14    -
<a href="2.0.2-SNAPSHOT/">2.0.2-SNAPSHOT/</a>      06-Mar-2020 15:51    -
<a href="2.0.1-SNAPSHOT/">2.0.1-SNAPSHOT/</a>      05-Mar-2020 17:39    -

So, I would like to automate the whole process to find out the latest folder name from it? I tried using
Code:
sort

using column
Code:
3,4

names but still not able to figure it out if this is the best solution as I don't know if, in long run whether column 3 and 4 will be right one to provide the latest folder?
can anyone suggest me how to get the latest
Code:
SNAPSHOT

from here best possible way?

PS: Now i tested with some other values sort is definitely not the right one.

Last edited by manas_ranjan; 03-09-2020 at 07:04 AM.. Reason: added PS
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

let curl output to stdout AND save to a file

hello hackers. i have a curl process running as cgi directly pushing stdout to the client. but i want to additionally save that stream to a file at the same time. any directions madly welcome. thanks in advance (3 Replies)
Discussion started by: scarfake
3 Replies

2. Shell Programming and Scripting

script to output curl result as html

hi, new to scripting and would like to know how can I have a script which will curl a few URLs and have the results such as the URLs being curled, dns lookup time, connection time, total time, etc save in a html format in a form of table with column and rows. thank you. (4 Replies)
Discussion started by: squidusr
4 Replies

3. Shell Programming and Scripting

Getting cURL to output verbose to a file

This is about to drive me crazy. What I want to do is simple: output ALL the verbose information from curl to a file I have read the manual, tried several options and searched this forum but no salvation... I'm using curl -k -Q "command" --user user:passwd --ftp-pasv --ftp-ssl -v... (1 Reply)
Discussion started by: caramandi
1 Replies

4. UNIX for Dummies Questions & Answers

latest files copying over to new path

ls -lrt | nawk -v D="$(date +'%b%e:'| sed 's/ //g')" 'D==$6$7":"{sub(".*"$9,$9);print}' This picks only the latest files created based on the timestamp for that particular day.. how do i copy over the same files to a different location???? (1 Reply)
Discussion started by: win4luv
1 Replies

5. Shell Programming and Scripting

ery weird wget/curl output - what should I do?

Hi, I'm trying to write a script to download RedHat's errata digest. It comes in a txt.gz format, and i can get it easily with firefox. HOWEVER: output is VERY strange when donwloading it in a script. It seems I'm getting a file of the same size - but partially text and partly binary! It... (5 Replies)
Discussion started by: jstilby
5 Replies

6. Shell Programming and Scripting

Encapsulating output of CURL and/or WGET

i use curl and wget quite often. i set up alarms on their output. for instance, i would run a "wget" on a url and then search for certain strings within the output given by the "wget". the problem is, i cant get the entire output or response of my wget/curl command to show up correctly in... (3 Replies)
Discussion started by: SkySmart
3 Replies

7. Shell Programming and Scripting

Filter output in curl

Hello guys, I'm writing a little script which sends me sms with my shell script via api of a sms provider. problem is I can't filter my curl output for this site: site url:... (1 Reply)
Discussion started by: genius90
1 Replies

8. Shell Programming and Scripting

Extracting urls from curl output

Hello. I use curl to fetch a website, then, I want to extract the URLs from this curls output. I tried both sed and grep, but couldnt figure it out. Ive tried : sed -n 's/href="\(*\).*/\1/p' results.txt and grep -o grep -o '<a href="http://*.*.*/*">' results.txt. What pattern... (6 Replies)
Discussion started by: jozo95
6 Replies

9. Shell Programming and Scripting

Search Files on a given path based on latest time stamp

find /app/data -name "Availability" - Below is the output now i need to filter based on latest modified timestamp. I know 3 is the latest modified time stamp but i tried different options but only filtering docs and not on headnote..Can any one tell me how to do that.. ... (2 Replies)
Discussion started by: vkiyv05
2 Replies

10. Web Development

Filename output in curl

How can I get the name of the default output filename from curl using the argument -O? Using -o one can choose a filename. I want to get the name of the original file, but don't understand how to get it. curl -o filename http://www.website.com curl -O http://www.website.com The... (3 Replies)
Discussion started by: locoroco
3 Replies
CURLOPT_SUPPRESS_CONNECT_HEADERS(3)			     curl_easy_setopt options			       CURLOPT_SUPPRESS_CONNECT_HEADERS(3)

NAME
CURLOPT_SUPPRESS_CONNECT_HEADERS - Suppress proxy CONNECT response headers from user callbacks SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SUPPRESS_CONNECT_HEADERS, long onoff); DESCRIPTION
When CURLOPT_HTTPPROXYTUNNEL(3) is used and a CONNECT request is made, suppress proxy CONNECT response headers from the user callback func- tions CURLOPT_HEADERFUNCTION(3) and CURLOPT_WRITEFUNCTION(3). Proxy CONNECT response headers can complicate header processing since it's essentially a separate set of headers. You can enable this option to suppress those headers. For example let's assume an HTTPS URL is to be retrieved via CONNECT. On success there would normally be two sets of headers, and each header line sent to the header function and/or the write function. The data given to the callbacks would look like this: HTTP/1.1 200 Connection established {headers}... HTTP/1.1 200 OK Content-Type: application/json {headers}... {body}... However by enabling this option the CONNECT response headers are suppressed, so the data given to the callbacks would look like this: HTTP/1.1 200 OK Content-Type: application/json {headers}... {body}... DEFAULT
0 PROTOCOLS
All EXAMPLE
CURL *curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); curl_easy_setopt(curl, CURLOPT_HEADER, 1L); curl_easy_setopt(curl, CURLOPT_PROXY, "http://foo:3128"); curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L); curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L); curl_easy_perform(curl); /* always cleanup */ curl_easy_cleanup(curl); } AVAILABILITY
Added in 7.54.0 RETURN VALUE
CURLE_OK or an error such as CURLE_UNKNOWN_OPTION. SEE ALSO
CURLOPT_HEADER(3), CURLOPT_PROXY(3), CURLOPT_HTTPPROXYTUNNEL(3), libcurl 7.54.0 April 28, 2016 CURLOPT_SUPPRESS_CONNECT_HEADERS(3)
All times are GMT -4. The time now is 12:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy