I have the following code to extract two dates using awk, which are then read into two awk variables new and old respectively.
Each dates on the html file pulled with curl request is in this format:
2015-04-06 09:40:37
And two are being extracted
However the strings are being split on white space within the date strings. I tried changing OFS to ',', but it was still splitting incorrectly.
Code:
read dateStrNew dateStrOld < <(curl -k -q "$curl_call" | html2text | gawk '/Newest Sequence/ { new=$3" "$4 }/Oldest Sequence/ \
{old=$3" "$4}END {OFS=","; print new,old }') //new = date, old = date
Both parts of the date are being assigned to each variable using $3 and $4, then the space needs to be added back in so that the string can be used afterwards with a date command.
I just can't work out what is wrong, any help would be very much appreciated! Thanks!