[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Operações em tabela
From: |
Cleoson Michiles Barreto |
Subject: |
Re: [shell-script] Operações em tabela |
Date: |
Wed, 09 Jul 2008 09:06:02 -0300 |
User-agent: |
Thunderbird 2.0.0.14 (X11/20080421) |
Olá,
Vê se isso ajuda:
[cleoson@maq]$ cat arq.sh
for i in $(cat $1 | tr "," ".")
do
echo "$i - 273.15" | bc -l
done | paste - - - -
[cleoson@maq]$ cat arq.txt
295,51 297,95 292,33 294,77
296,45 300,18 293,76 298,13
[cleoson@maq]$ ./arq.sh arq.txt
22.36 24.80 19.18 21.62
23.30 27.03 20.61 24.98
[]'s
Cléoson
Em 08-07-2008 11:27, marsori2004 escreveu: :
Olá pessoal, tor fazendo migração de um arq .txt pra outro.
O primeiro é temperatura em Kelvin mais ou menos assim:
295,51 297,95 292,33 294,77
296,45 300,18 293,76 298,13
Preciso passar ele pra Celsius, ou seja, subtrair o valor de cada
coluna do arquivo anterior por 273,15 o que ficaria assim:
22,36 24,80 19,18 21,62
23,30 27,03 20,61 24,98
295,51-273,15=22,36
296,45-273,15=23,30 e assim por diante, mas o arq eh imenso.
Tentei fazer com xargs, expr e naum consegui..
Quem poder dá uma dica ficarei muito grato...
Se alguém tiver dúvidas sobre os arquivos, posso esclarecer..
Abraço a todos...
.
"Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa
pública federal regida pelo disposto na Lei Federal nº 5.615, é enviada exclusivamente a
seu destinatário e pode conter informações confidenciais, protegidas por sigilo
profissional. Sua utilização desautorizada é ilegal e sujeita o infrator às penas da lei.
Se você a recebeu indevidamente, queira, por gentileza, reenviá-la ao emitente,
esclarecendo o equívoco."
"This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a
government company established under Brazilian law (5.615/70) -- is directed exclusively
to its addressee and may contain confidential data, protected under professional secrecy
rules. Its unauthorized use is illegal and may subject the transgressor to the law's
penalties. If you're not the addressee, please send it back, elucidating the
failure."