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

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

Re: Res: RES: [shell-script] (unknown)


From: rodrigocnery
Subject: Re: Res: RES: [shell-script] (unknown)
Date: Fri, 17 Aug 2007 16:35:02 -0000
User-agent: eGroups-EW/0.82

Olá Íkami, o comando grep com expressões regulares pode ser utilizado 
também para sua necessidade, veja:

 /tmp >grep "[9][0-9],[0-9][0-9]$" <nome_do_arquivo>
SYSAUX                             225280.00       8384.00     
216896.00       3,72      96,28
SYSTEM                             307200.00      22400.00     
284800.00       7,29      92,71


--- Em address@hidden, ikami <ikamig@...> escreveu
>
> Muito obrigado a você e ao Julio que me responderam super rapidos. 
Foi so o tempo deu ir pegar um café! eheheehe
> O seu comando com o awk funcionou perfeitamente. Retornou somente 
as linhas que eu precisava. Só nao tentendi nada o que ele fez. Só 
falta agora apagar o restante do lixo que sobrou no arquivo. Vou 
tentar fazer isso aqui.
> O comando que o Julio mandou (
> tr -s ' ' < Arquivo | cut -f6 -d ' ') quase que funcionou. Acho q 
por ter espaços e tabs misturados no arquivo ele pegou ora a ultima 
coluna ora a penultima.
> Algumas reflexões:
> 1- Ja enrolei demais pra comprar o livro do Julio. Tenho que 
providenciá-lo o mais rápido possível.
> 2- Aprender awk o quanto antes. Fiquei boqueaberto quando o 
executei e a resposta veio certinha! ehehehhe Alguém pode me indicar 
alguma apostila, site, livro ou o que seja sobre awk?
> 
> Grato
>  Íkami
> 
> ----- Mensagem original ----
> De: Info Suporte - Rodrigo Nery <rodrigo@...>
> Para: "address@hidden" <shell-
address@hidden>
> Enviadas: Sexta-feira, 17 de Agosto de 2007 11:26:52
> Assunto: RES: [shell-script] (unknown)
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
> 
> 
>     
>             Utilize o comando do awk abaixo.
> 
> 
> 
> awk '{if ($NF > 90) {print $0}}' <nome_do_arquivo>
> 
> 
> 
> TABLESPACE                          TOTAL KB      LIVRE KB    
OCUPADO KB
> 
> % LIVRE  % OCUPADO
> 
> SYSAUX                             225280.00       8384.00     
216896.00
> 
> 3,72      96,28
> 
> SYSTEM                             307200.00      22400.00     
284800.00
> 
> 7,29      92,71
> 
> 
> 
> Rodrigo
> 
> 
> 
> -----Mensagem original---- -
> 
> De: ikami [mailto:ikamig@yahoo. com.br]
> 
> Enviada em: sexta-feira, 17 de agosto de 2007 11:10
> 
> Para: shell-script@ yahoogrupos. com.br
> 
> Assunto: [shell-script] (unknown)
> 
> 
> 
> Ola pessoal!
> 
> Estou precisando fazer um script para tratar um arquivo. Estou 
tentando
> 
> fazer isso para terminar um plugin para o nagios.
> 
> Seguinte, preciso pegar um arquivo (lista de tabelas de banco) que 
meu banco
> 
> de dados gera e verificar se alguma tabela esta estourando ou nao 
(tem
> 
> alguma esta com a utilizacao acima de 90%).
> 
> O aquivo ter algumas sujeiras no comeco e no final e no meio tem as
> 
> informacoes que tenho q tratar.
> 
> Estou mandando um exemplo do arquivo em anexo porque colando aqui a
> 
> formatacao dele muda.
> 
> Na ultima coluna ele mostra a % ocupada da tabela. São estes campos 
que
> 
> quero pegar.
> 
> A idéia eh ler essa coluna e quando achar um valor maior ou igual a 
90 ele
> 
> me retornar a linha inteira
> 
> 
> 
> Tentei ler somente essa coluna com o comando cut mas nao tive 
sucesso. Acho
> 
> q pq ele nao está reconhecendo as colunas. Entao, lendo alguns posts
> 
> passados da lista descobri o comando expand e unexpand e tentei 
colocar
> 
> algumas tabulacoes entre as linhas para depois fazer o cut na 
coluna. Nao
> 
> consegui tb.
> 
> 
> 
> Resumindo. Estou travado ainda na ideia de ler essa ultima coluna!
> 
> 
> 
> Grato.
> 
> 
> 
> Flickr agora em português. Você clica, todo mundo vê.
> 
> http://www.flickr. com.br/
> 
>   ----------
> 
> 
> 
> SQL*Plus: Release 10.1.0.4.0 - Production on Tue Aug 14 16:42:33 
2007
> 
> 
> 
> Copyright (c) 1982, 2005, Oracle.  All rights reserved.
> 
> 
> 
> Enter user-name: 
> 
> 
> 
> Connected to:
> 
> 
> 
> Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 
Production
> 
> 
> 
> With the Partitioning, OLAP and Data Mining options
> 
> 
> 
> SQL> SQL> SQL> SQL> SQL> SQL>   2    3    4    5    6    7    8    
9   10
> 
> 11   12   13   14   15  
> 
> 
> 
> TABLESPACE                        TOTAL KB      LIVRE KB    OCUPADO 
KB
> 
> % LIVRE  % OCUPADO
> 
> 
> 
> ------------ --------- --------- ------------ - ------------ - -----
------- -
> 
> ---------- ----------
> 
> 
> 
> ADMINISTRATI_ DAT_01             102400.00     101760.00        
640.00
> 
> 99,38    ,63
> 
> 
> 
> ADMINISTRATI_ IDX_01             102400.00     102336.00         
64.00
> 
> 99,94    ,06
> 
> 
> 
> AUDITORIA_DAT_ 01                102400.00     100608.00       
1792.00
> 
> 98,25   1,75
> 
> 
> 
> CONFIGURACAO_ DAT_01             102400.00     102272.00        
128.00
> 
> 99,88    ,13
> 
> 
> 
> CONFIGURACAO_ IDX_01             102400.00     102336.00         
64.00
> 
> 99,94    ,06
> 
> 
> 
> FRAMEWORK_DAT_ 01                102400.00     102272.00        
128.00
> 
> 99,88    ,13
> 
> 
> 
> FRAMEWORK_IDX_ 01                102400.00     102336.00         
64.00
> 
> 99,94    ,06
> 
> 
> 
> HELP_DAT_01                      102400.00      98304.00       
4096.00
> 
> 96         4
> 
> 
> 
> HELP_IDX_01                      102400.00     102336.00         
64.00
> 
> 99,94    ,06
> 
> 
> 
> INTERACAO_USR_ DAT_01            102400.00      99840.00       
2560.00
> 
> 97,5     2,5
> 
> 
> 
> INTERACAO_USR_ IDX_01            102400.00     102336.00         
64.00
> 
> 99,94    ,06
> 
> 
> 
> SEGURANCA_DAT_ 01                102400.00     102272.00        
128.00
> 
> 99,88    ,13
> 
> 
> 
> SEGURANCA_IDX_ 01                102400.00     102336.00         
64.00
> 
> 99,94    ,06
> 
> 
> 
> TREINAMENTO                      102400.00      35584.00
        66816.00
> 
> 34,75  65,25
> 
> 
> 
> SYSAUX                                   225280.00       
8384.00     216896.00
> 
> 3,72   96,28
> 
> 
> 
> SYSTEM                                   307200.00      
22400.00     284800.00
> 
> 7,29   92,71
> 
> 
> 
> UNDOTBS1                         204800.00     195072.00       
9728.00
> 
> 95,25   4,75
> 
> 
> 
> USERS                            124160.00      47616.00
        76544.00
> 
> 38,35  61,65
> 
> 
> 
> 18 rows selected.
> 
> 
> 
> SQL> Disconnected from Oracle Database 10g Enterprise Edition 
Release
> 
> 10.2.0.3.0 - Production
> 
> 
> 
> With the Partitioning, OLAP and Data Mining options
> 
> 
> 
> [As partes desta mensagem que não continham texto foram removidas]
> 
> 
> 
> ------------ --------- --------- --------- --------- --------- -
> 
> Esta lista não admite a abordagem de outras liguagens de 
programação, como
> 
> perl, C etc. Quem insistir em não seguir esta regra será moderado 
sem prévio
> 
> aviso.
> 
> ------------ --------- --------- --------- --------- --------- -
> 
> Sair da lista: shell-script- unsubscribe@ yahoogrupos. com.br
> 
> ------------ --------- --------- --------- --------- --------- -
> 
> Esta lista é moderada de acordo com o previsto em
> 
> http://www.listas- discussao. cjb.net
> 
> ------------ --------- --------- --------- --------- --------- -
> 
> Servidor Newsgroup da lista: news.gmane.org
> 
> Grupo: gmane.org.user- groups.programmi ng.shell. brazil
> 
> 
> 
> Links do Yahoo! Grupos
> 
> 
> 
> 
> 
>     
>   
> 
>     
>     
> 
> 
> 
> 
> <!--
> 
> #ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, 
sans-serif;}
> #ygrp-mlmsg table {font-size:inherit;font:100%;}
> #ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, 
clean, sans-serif;}
> #ygrp-mlmsg pre, code {font:115% monospace;}
> #ygrp-mlmsg * {line-height:1.22em;}
> #ygrp-text{
> font-family:Georgia;
> }
> #ygrp-text p{
> margin:0 0 1em 0;}
> #ygrp-tpmsgs{
> font-family:Arial;
> clear:both;}
> #ygrp-vitnav{
> padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
> #ygrp-vitnav a{
> padding:0 1px;}
> #ygrp-actbar{
> clear:both;margin:25px 0;white-space:nowrap;color:#666;text-
align:right;}
> #ygrp-actbar .left{
> float:left;white-space:nowrap;}
> .bld{font-weight:bold;}
> #ygrp-grft{
> font-family:Verdana;font-size:77%;padding:15px 0;}
> #ygrp-ft{
> font-family:verdana;font-size:77%;border-top:1px solid #666;
> padding:5px 0;
> }
> #ygrp-mlmsg #logo{
> padding-bottom:10px;}
> 
> #ygrp-vital{
> background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
> #ygrp-vital #vithd{
> font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-
transform:uppercase;}
> #ygrp-vital ul{
> padding:0;margin:2px 0;}
> #ygrp-vital ul li{
> list-style-type:none;clear:both;border:1px solid #e0ecee;
> }
> #ygrp-vital ul li .ct{
> font-weight:bold;color:#ff7900;float:right;width:2em;text-
align:right;padding-right:.5em;}
> #ygrp-vital ul li .cat{
> font-weight:bold;}
> #ygrp-vital a {
> text-decoration:none;}
> 
> #ygrp-vital a:hover{
> text-decoration:underline;}
> 
> #ygrp-sponsor #hd{
> color:#999;font-size:77%;}
> #ygrp-sponsor #ov{
> padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
> #ygrp-sponsor #ov ul{
> padding:0 0 0 8px;margin:0;}
> #ygrp-sponsor #ov li{
> list-style-type:square;padding:6px 0;font-size:77%;}
> #ygrp-sponsor #ov li a{
> text-decoration:none;font-size:130%;}
> #ygrp-sponsor #nc {
> background-color:#eee;margin-bottom:20px;padding:0 8px;}
> #ygrp-sponsor .ad{
> padding:8px 0;}
> #ygrp-sponsor .ad #hd1{
> font-family:Arial;font-weight:bold;color:#628c2a;font-
size:100%;line-height:122%;}
> #ygrp-sponsor .ad a{
> text-decoration:none;}
> #ygrp-sponsor .ad a:hover{
> text-decoration:underline;}
> #ygrp-sponsor .ad p{
> margin:0;}
> o {font-size:0;}
> .MsoNormal {
> margin:0 0 0 0;}
> #ygrp-text tt{
> font-size:120%;}
> blockquote{margin:0 0 0 4px;}
> .replbq {margin:4;}
> -->
> 
> 
> 
> 
> 
> 
> 
> 
>       Flickr agora em português. Você clica, todo mundo vê.
> http://www.flickr.com.br/
> 
> [As partes desta mensagem que não continham texto foram removidas]
>




reply via email to

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