This is the file which contains only neccessary values from the output of curl command i.e TEMP_FILE
Proxy Hostname
server0123.domain.com
Proxy IP address
XXX.XXX.XX.XX port 0000
Proxy Version
SGOS X.X.X.X
Proxy Serial #
000000001
Client IP
YYY.YYY.YYY.YYY
Client Logged In As
Groups user is member of
And here is the script which I have
#!/bin/bash
TEMP_FILE=/tmp/dashbosrd_details.txt
curl --silent --proxy <proxy_server_address:Port> --url http://dashbord.info/ | sed -e '/<d[td]\|^[[:blank:]]*$/!d; s/<[^>]*>//g; s/^ *//; /^\(Proxy\|Client\)/ s/$/:/' > $TEMP_FILE
Client_Hostname=`hostname --fqdn`
Proxy_Hostname=`awk '/Proxy Hostname/{getline;print;}' $TEMP_FILE`
Proxy_IP_address=`awk -F "port" '/Proxy IP address/{getline;print $1;}' $TEMP_FILE`
Proxy_IP_Port=`awk -F "port" '/Proxy IP address/{getline;print $2;}' $TEMP_FILE`
Proxy_Serial=`awk '/Proxy Serial #/{getline;print;}' $TEMP_FILE`
Client_IP=`awk '/Client IP/{getline;print;}' $TEMP_FILE`
Client_Logged_In_As=`whoami`
echo "$Client_Hostname" "|" "$Proxy_Hostname" "|" "$Proxy_IP_address" "|" "$Proxy_IP_Port" "|" "$Proxy_Serial" "|" "$Client_IP" "|" "$Client_Logged_In_As"
But the output of the script comes in a random or disorganized way as given below
| <Client_Logged_In_As i.e whoami>YY.YYY.YYY.YYYort 0000 server0123.domain.com
Desired output:
myserver.domain.com | server0123.domain.com | XXX.XXX.XX.XX | 0000 | 000000001 | YYY.YYY.YYY.YYY | <Client_Logged_In_As i.e whoami>