#bash - February 2020

bashArchived
26 messages

A channel for bash scripting

February 2020
Hemanth
Hemanthover 6 years ago
@Hemanth has joined the channel
Hemanth
Hemanthover 6 years ago
set the channel description: A channel for bash scripting
Adam Crews
Adam Crewsover 6 years ago
@Adam Crews has joined the channel
erik
erikover 6 years ago
@Erik Osterman (Cloud Posse) has joined the channel
Tyrone Meijn
Tyrone Meijnover 6 years ago
@Tyrone Meijn has joined the channel
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@Hemanth any burning bash questions?
Jeremy G
Jeremy Gover 6 years ago
@Jeremy G has joined the channel
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 6 years ago
@Andriy Knysh (Cloud Posse) has joined the channel
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago
@Ievgenii Shepeliuk has joined the channel
Hemanth
Hemanthover 6 years ago
@Erik Osterman (Cloud Posse) haha yes 😄
Hemanth
Hemanthover 6 years ago(edited)
I am trying to do some sorting stuff, my output is like (those are aws instance IDs)
Instance-BCD222
19.5140495 
12.7219977 
13.3188209
Instance-OIUQWE
Instance-QOWIEU
Instance-QOWIEU
Instance-BCD123
19.5140495 
12.7219977 
13.3188209
Instance-QOWIEU
Instance-QWOEIU
Instance-ASLDKJ
Instance-BCD231
19.5140495 
12.7219977 
13.3188209

I want to remove those instances Id's in that list that doesn't have numbers under them
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Oh, I think this is stemming from an earlier question that involved jq?
Hemanth
Hemanthover 6 years ago
yes
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Since jq is so powerful, better to share that part again.
Hemanth
Hemanthover 6 years ago
trying to work my way through
Hemanth
Hemanthover 6 years ago
sure
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
It may be easier to get the query right rather than offload it to bash.
Hemanth
Hemanthover 6 years ago
yes i am amazed at jq
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Yea, it's awesome
bradym
bradymover 6 years ago
@bradym has joined the channel
Kendall Link
Kendall Linkover 6 years ago
@Kendall Link has joined the channel
Chris Fowles
Chris Fowlesover 6 years ago
@Chris Fowles has joined the channel
erik-stephens
erik-stephensover 6 years ago
@erik-stephens has joined the channel
Tertius Stander
Tertius Standerover 6 years ago
@Tertius Stander has joined the channel
MorganGeek
MorganGeekover 6 years ago
@MorganGeek has joined the channel
Jeremy G (Cloud Posse)
Jeremy G (Cloud Posse)over 6 years ago
@Hemanth try this:
for i in $(aws ec2 describe-instances  | jq -r '.["Reservations"]|.[]|.Instances|.[]| .InstanceId' | sort -n); do echo "$i,$(aws cloudwatch get-metric-statistics --metric-name CPUUtilization --start-time 2020-02-20T12:00:00 --end-time 2020-02-20T13:00:00 --period 60 --namespace AWS/EC2  --extended-statistics p80 --dimensions Name=InstanceId,Value=$i | jq -r '[.Datapoints[]|select(.ExtendedStatistics.p80 >=0).ExtendedStatistics.p80] | @csv')" | grep -v ',$'; done

No earlier messagesBrowse by dateMarch 2020