Olá Waldirio, Muito bom! Muito obrigado pela atenção, funcionou bonito. Um forte abraço e fique com Deus.
--- Em [email protected], Waldirio Manhães Pinheiro <waldi...@...> escreveu > > Amigos, boa tarde > > Segue > > jeju:[xxx] > cat text > INSERT INTO CADASTRO (id, cpf, nome, email) VALUES (123, 12345678901, > 'fulano de tal', NULL); > > jeju:[xxx] > sed -e 's/, email//g' -e 's/, NULL//g' text > INSERT INTO CADASTRO (id, cpf, nome) VALUES (123, 12345678901, 'fulano de > tal'); > > > Ps.: O que ocorreu ?!! Substituição da string ", email" por nada e ", NULL" > por nada. ;-) > > Abraços > Waldirio > > 2010/6/16 jrsreis <jrsr...@...> > > > > > > > Olá pessoal, > > > > Tenho o seguinte problema: > > > > Tenho um arquivo com o seguinte conteúdo: > > > > INSERT INTO CADASTRO (id, cpf, nome, email) VALUES (123, 12345678901, > > 'fulano de tal', NULL); > > > > E gostaria de modificar o arquivo para: > > > > INSERT INTO CADASTRO (id, cpf, nome) VALUES (123, 12345678901, 'fulano de > > tal'); > > > > Tentei utilizar o awk com o gsub e consegui o seguinte: > > > > awk '{ gsub(/email/, "",$7); gsub(/cpf,/, "cpf",$5); gsub(/NULL);/, > > ")",$12); print}' file > > > > Mais ou menos isso aí. Só que o conteudo do arquivo ficou assim: > > INSERT INTO CADASTRO (id, cpf, nome, email ) VALUES (123, 51220, 'fulano de > > tal', ); > > > > Ou seja, ficou com uma vírgula e o espaço no final. Como poderia solucionar > > este caso? > > > > Um forte abraço a todos e fiquem com Deus. > > > > > > > > > > -- > ______________ > Atenciosamente > Waldirio > msn: waldi...@... > Skype: waldirio > Site: www.waldirio.com.br > Blog: blog.waldirio.com.br > PGP: www.waldirio.com.br/public.html > > > [As partes desta mensagem que não continham texto foram removidas] >
