shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transformar linhas em coluna


From: itamarnet
Subject: Re: Transformar linhas em coluna
Date: 17 Feb 2016 07:21:12 -0800

Só um exemplo do que pode ser feito em awk:

 awk '
   BEGIN {FS=": "; print "Computer Name:Product Name:Product Key:Product ID"}
   /Product Name/ {split("",linhas);linha[2]=$2}
   /Product ID/ {linha[4]=$2}
   /Product Key/ {linha[3]=$2}
   /Computer Name/ {linha[1]=$2}
   /Time/ {print linha[1] ":" linha[2] ":" linha[3] ":" linha[4]}
'

Note que o cabeçalho é " Computer Name:Product Name:Product Key:Product ID" sem repetir como no seu original
E cada campo é separado por ":", tanto no cabeçalho quanto nos registros.

Ajuda?

[]'s
Itamar
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]