Friday, February 15, 2019

Number and E-notation

Today I found out that the AWS usage report, some usages are showing up as E-notation(for example, 1.6E-5 which shall be  1.6×105. That broken my code as I am trying to load them into my Oracle table as numbers. 

SO I will need to find a way to to a transfer, after awhile, here is the working soultions

round(decode(instr(UsageQuantity,'E'),0,UsageQuantity,to_number(replace(UsageQuantity,' ',''),'9.99999999999999999999EEEE')),2),

Thx.

Monday, February 11, 2019

remote ssh inside a while loop

Today I found an issue for one of my script, the script is get a list server from server A and remote ssh Server B for doing something, the issues is that even though I have multiple servers but the ssh would stop after the first one, my original code is like this:

cat server_list|while read Server
 ssh -l oraware B  "echo $server_name"
done

After some digging, the issues is the  read will treat standard input as it's input.

To make it works, just add the red part to the ssh


cat server_list|while read Server
 ssh -l oraware B  "echo $server_name" < /dev/null
done