I'm piping the output of a curl request to gawk so that I can pull some data. The gawk code is already working if I'm searching through the html file which curl request produces. However, I was hoping to simply edit in place, as I just need to allocate 2 date variables. I've been looking at using tee and process substitution. Is there any way to somehow fork the output of the curl request in order to assign 2 different variables, both using gawk and command substitution.
Here's a snippet of my code, I've hidden the full details of the curl request, but it is going to pull an html report which will contain: Oldest Sequence, date and Newest Sequence, date on separate lines. The gawk has already been tested on the data.
curl -k -q "https://user:password@ipaddress/report"
I want the output of the above command to be piped or otherwise to the two commands below
date1="$(date -d $(gawk '/Newest Sequence/ {print $3,$4}') +%s)"
date2="$(date -d $(gawk '/Oldest Sequence/ {print $3,$4}') +%s)"
Is this possible without creating a file? I will be running the request at frequent intervals and sending the result to a socket, I'd rather avoid unnecessary files if possible
Aucun commentaire:
Enregistrer un commentaire