Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to get the latest uploaded path from curl output? Post 303044924 by nezabudka on Monday 9th of March 2020 07:54:08 AM
Old 03-09-2020
Hi
You can use the GNU extension - the 'asorti' function in 'awk'
Code:
awk -F' *|-' -vm="$(LC_ALL=C locale ab_alt_mon)" '
BEGIN   {for(n=split(m, M, ";"); n; n--) Mm[M[n]]=n}
        {A[$7 Mm[$6] $5 $8]=$0}
END     {n=asorti(A, D); print A[D[n]]}
' response.txt

but this way it seems easier and faster
Code:
awk -F' *|-' -vm="$(LC_ALL=C locale ab_alt_mon)" '
BEGIN   {for(n=split(m, M, ";"); n; n--) Mm[M[n]]=n}
        {print $7 Mm[$6] $5 $8 " " $0}
' response.txt | sort | tail -1 | cut -d' ' -f2-

--- Post updated at 15:54 ---

Something I did not think, if only the last snapshot is needed it will be easier
Code:
awk -F' *|-' -vm="$(LC_ALL=C locale ab_alt_mon)" '
BEGIN   {for(n=split(m, M, ";"); n; n--) Mm[M[n]]=n}
        {f=$7 Mm[$6] $5 $8; if(f>str) {str=f; st=$0}}
END     {print st}
' response.txt


Last edited by nezabudka; 03-09-2020 at 09:01 AM..
This User Gave Thanks to nezabudka For This Post:
 

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
s_curl(3rheolef)						    rheolef-6.1 						  s_curl(3rheolef)

NAME
s_curl -- curl-like operator for the Stokes stream function computation SYNOPSIS
form(const space M, const space& V, "s_curl"); DESCRIPTION
Assembly the form associated to the s_curl operator on a finite element space V: / | b(xi,u) = | u.s_curl(xi) dx | / Omega The M and V space may be a either P1 or P2 finite element space. The M space is scalar-valued while the V is vector-valued. See also form(2) and space(2). For cartesian coordinate systems, this form coincide with the usual "curl" one (see curl(3)). In the axisymmetric case: / | (d xi d xi ) b(xi,u) = | (---- ur - ---- uz) r dr dz | (d z d r ) / Omega The b form is denoted as "s_curl", for Stokes stream function computation (see s_grad_grad(3)) as it is closely related to the "curl" oper- ator (see curl(3)), but differs by the r and 1/r factors, as: ( d (r xi) d xi ) curl(xi) = ( (1/r) -------- ; - -----) ( d r d z ) while ( d xi d xi ) s_curl(xi) = ( ---- ; - ---- ) ( d r d z ) Notice also that the differentiation is performed on the xi variable here: b(xi,u)=(s_curl(xi),u) while the "curl" form brings the differ- entiation on the u vector-valued variable: (curl(u),xi), i.e. a transpose formulation. ORIENTATION AND SIGN FIX
The (r,theta,z) coordinate system has positive orientation, thus (z,r,theta) and (z,r) are positive also. But (r,z,theta) and (r,z) are negative : the sign of s_curl is then inverted to obtain the same result as if (z,r) was used. EXAMPLE
The following piece of code build the form associated to the P1 approximation: geo g("square"); space M(g, "P1"); space V(g, "P1", "vector"); form a(M, V, "s_curl"); SEE ALSO
form(2), space(2), curl(3), s_grad_grad(3), curl(3) rheolef-6.1 rheolef-6.1 s_curl(3rheolef)
All times are GMT -4. The time now is 07:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy