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

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

Re: Remover caracter do texto


From: weberlf
Subject: Re: Remover caracter do texto
Date: Mon, 12 Dec 2005 22:36:27 -0000
User-agent: eGroups-EW/0.82

> vc pode usar o modo de procura e substituição global do sed
> 
> sed 's/procura/substitui/g'
> 
> $ sed 's/\)\;/\)/g' arquivo_original > arquivo modificado
> 
> no caso, queremos trocar ');' por ')', entretantovc 
precisa "escapar" estes
> caracteres pois eles tem significados diferentes para o SED.
> 
> mas se vc tem apenas o ';' nesse caso pode usar o tr
> 
> $ tr -d ';' arquivo_original > arquivo modificado
> 
  
Tiago, 

Acho que não me expressei direito. 
Meu arquivo.txt original abaixo

CREATE TABLE tmor_1212_cred_agreg (
    seq_ctrc integer NOT NULL,
    tp_credito character(1) NOT NULL,
    placa_agreg character(7) NOT NULL,
    data_baixa date NOT NULL,
    vlr_credito numeric(9,2) NOT NULL,
    seq_ficha_frete integer NOT NULL,
    vlr_credito_orig numeric(9,2) NOT NULL,
    data_inclusao date,
    hora_inclusao time without time zone,
    CONSTRAINT cst01_tmor_1212_cred_agreg CHECK (((tp_credito 
= 'C'::bpchar) OR
(tp_credito = 'E'::bpchar)))
);

Utilizei o comando:

sed '/CONSTRAINT/d;' arquivo.txt
  
Este foi o resultado:

CREATE TABLE tmor_1212_cred_agreg (
    seq_ctrc integer NOT NULL,
    tp_credito character(1) NOT NULL,
    placa_agreg character(7) NOT NULL,
    data_baixa date NOT NULL,
    vlr_credito numeric(9,2) NOT NULL,
    seq_ficha_frete integer NOT NULL,
    vlr_credito_orig numeric(9,2) NOT NULL,
    data_inclusao date,
    hora_inclusao time without time zone,
);

O que desejo é time zone sem a virgula, ou seja o que antecede );
    ...
    ...
    ...
    seq_ficha_frete integer NOT NULL,
    vlr_credito_orig numeric(9,2) NOT NULL,
    data_inclusao date,
    hora_inclusao time without time zone
);

Obrigado pela ajuda

Weber




reply via email to

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