Eu tenho uma saída cli como abaixo,
GROUP DEFINITIONS SERVICE DIMENSION
RESULTSBYTIME False
KEYS AWS CloudShell
BLENDEDCOST 0.0000026589 USD
KEYS AWS CloudTrail
BLENDEDCOST 0.000001 USD
KEYS AWS Config
BLENDEDCOST 46.921 USD
KEYS AWS Glue
BLENDEDCOST 355.70735552 USD
KEYS AWS Key Management Service
BLENDEDCOST 0.10418545 USD
KEYS AWS Lambda
BLENDEDCOST 0.0000002605 USD
KEYS AWS Migration Hub Refactor Spaces
BLENDEDCOST 0 USD
KEYS AWS Secrets Manager
BLENDEDCOST 2.0496788951 USD
KEYS AWS Security Hub
BLENDEDCOST 0.028892556 USD
KEYS AWS Service Catalog
BLENDEDCOST 0 USD
KEYS AWS Step Functions
BLENDEDCOST 0.0000000031 USD
KEYS AWS Support (Business)
BLENDEDCOST 246.2376324993 USD
KEYS AWS Systems Manager
BLENDEDCOST 0.000351 USD
KEYS AWS Transfer Family
BLENDEDCOST 208.8 USD
KEYS Amazon EC2 Container Registry (ECR)
BLENDEDCOST 0.2636971622 USD
KEYS EC2 - Other
BLENDEDCOST 325.4630384796 USD
KEYS Amazon Elastic Compute Cloud - Compute
BLENDEDCOST 694.4962624953 USD
KEYS Amazon Elastic Container Service for Kubernetes
BLENDEDCOST 69.890509083 USD
KEYS Amazon Elastic File System
BLENDEDCOST 0.0000002652 USD
KEYS Amazon Elastic Load Balancing
BLENDEDCOST 73.2040001769 USD
Estou esperando a saída abaixo, a duplicata BLENDEDCOST deve ser removida e as CHAVES devem vir em uma nova linha. Converter linha em colunas e duplicar deve ser removido?
AWS CloudShell 0.0000026589 USD
AWS CloudTrail 0.000001 USD
AWS Config 46.921 USD
AWS Glue 355.7073555 USD
AWS Key Management Service 0.10418545 USD
AWS Lambda 0.0000002605 USD
AWS Migration Hub Refactor Spaces 0 USD
AWS Secrets Manager 2.049678895 USD
AWS Security Hub 0.028892556 USD
AWS Service Catalog 0 USD
AWS Step Functions 0.0000000031 USD
AWS Support (Business) 246.2376325 USD
AWS Systems Manager 0.000351 USD
AWS Transfer Family 208.8 USD
Amazon EC2 Container Registry (ECR) 0.2636971622 USD
EC2 - Other 325.4630385 USD
Amazon Elastic Compute Cloud - Compute 694.4962625 USD
Amazon Elastic Container Service for Kubernetes 69.89050908 USD
Amazon Elastic File System 0.0000002652 USD
Amazon Elastic Load Balancing 73.20400018 USD
Amazon Elastic MapReduce 2.28898852 USD
Amazon Glacier 0.0000000025 USD
Amazon GuardDuty 7.367077065 USD
Amazon Inspector 1 USD
Amazon Location Service 0 USD
Amazon Relational Database Service 388.1651428 USD
Amazon Route 53 0.508976 USD
Amazon Simple Notification Service 0.2022960904 USD
Amazon Simple Queue Service 0 USD
Amazon Simple Storage Service 3.338266835 USD
Amazon Simple Workflow Service 0.0000000015 USD
Amazon Virtual Private Cloud 147.4110373 USD
AmazonCloudWatch 60.12971039 USD
CloudWatch Events 0.000048 USD
CodeBuild 29.71339194 USD
Com GNU
sed
:ou
perl
:Para corresponder à sua saída, você precisará adicionar "Custo combinado" ao cabeçalho e remover a segunda linha e remover o
USD
, por exemplo, saída do tubo para:No total:
Saída:
Alternativa muito fácil com saída que deve ser bastante fácil de corrigir:
Com
pcregrep
:Ou com padrão
sed
:(não cuidando de duplicatas , pois não está claro em sua descrição como elas seriam).