The UNIX and Linux Forums  
Olá e boas-vindas de Estados Unidos para o UNIX e Linux Forum! Obrigado por visitar e fazer parte da nossa comunidade global.

Go Back   O UNIX e Linux Forum > Top Fóruns > Programação Shell Script e
.
google unix.com



Programação Shell Script e Post perguntas sobre ksh, CSH, SH, BASH, Perl, PHP, SED, Awk e outros scripts shell e shell scripts línguas aqui.

Mais UNIX e Linux Fórum Tópicos Você pode achar Helpfull
Fio Thread Starter Fórum Respostas Última postagem
awk Shell Script erro: "Erro de sintaxe:` Split 'inesperado Herry UNIX para Dummies Perguntas & Respostas 2 03-17-2008 11:16
erro durante a correr: St9bad_alloc - Como esse erro ao utilizar algumas conversão progr sathu_pec Programação Shell Script e 1 01-21-2008 02:38
Eu tenho ... como erro de erro de sintaxe na linha 1, teleimpressor koti_rama UNIX & avançada para usuários experientes 2 07-07-2007 08:35
erro na leitura secções erro instalar doelman Sun Solaris 2 02-05-2007 12:21
Erro: Erro interno do sistema: Não foi possível inicializar o arquivo de saída padrão firkus UNIX para Dummies Perguntas & Respostas 2 10-25-2005 04:23

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
Linkback Thread Tools Pesquisar este Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-29-2007
Raghuram.P Raghuram.P is offline
Usuário
  
 

Join Date: Feb 2007
Lugares: 44
Erro ao usar sed

Oi,
Eu tenho um arquivo de entrada com o seguinte conteúdo


-------------------------------------------------- ------- Executar Número: 1 --------------------------------------- --------------------
test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt] | Começar | 05/28/2007 02:19:30 | TESTE | 8651
-------------------------------------------------- ------- out_file ------------------------------------------ -----------------
item_id | status_desc | descrição
test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt] | Encerrado | 05/28/2007 02:19:33 | TESTE | 8651
-------------------------------------------------- ------- Executar Número: 2 --------------------------------------- --------------------
test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt] | Começar | 05/28/2007 02:27:25 | TESTE | 24745
-------------------------------------------------- ------- out_file ------------------------------------------ -----------------
item_id | status_desc | descrição
test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt] | Encerrado | 05/28/2007 02:27:27 | TESTE | 24745
-------------------------------------------------- ------- Executar Número: 3 --------------------------------------- --------------------
test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt] | Começar | 05/28/2007 02:56:32 | TESTE | 5560
-------------------------------------------------- ------- out_file ------------------------------------------ -----------------
item_id | status_desc | descrição
test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt] | Encerrado | 05/28/2007 02:56:34 | TESTE | 5560
-------------------------------------------------- ------- Executar Número: 4 --------------------------------------- --------------------
test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt] | Começar | 05/28/2007 02:57:32 | TESTE | 11961
-------------------------------------------------- ------- out_file ------------------------------------------ -----------------
item_id | status_desc | descrição
test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt] | Encerrado | 05/28/2007 02:57:33 | TESTE | 11961
-------------------------------------------------- ------- Executar Número: 5 --------------------------------------- --------------------
test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt] | Começar | 05/28/2007 04:17:31 | TESTE | 24685
-------------------------------------------------- ------- out_file ------------------------------------------ -----------------
item_id | status_desc | descrição
test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt] | Encerrado | 05/28/2007 04:17:33 | TESTE | 24685


Entrada para o guião será

test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt]

Meu trabalho consiste em extrair a última ocorrência da expressão que é a partir IP_EXPR | Started tp IP_EXPR | Completed

Tentei com sed mas dá o seguinte erro
sed:-E expressão # 1, char 40: caracteres extras após o comando

Na sequência é o meu código

IP \u003d "test_run-layout test_vaal-i [/ x/TEST/batch/temp/20070528_ip.txt / x/TEST/batch/temp/20070528__op.txt]"
IP_FILE \u003d "test.txt"

EXPR \u003d `echo $ IP | sed 's / \ [/ / g' | sed 's / \] / / g' `
echo "expr é: $ (EXPR)"

EXTRAÍDO \u003d `cat $ IP_FILE | sed 's / \ [/ / g' | sed 's / \] / / g' |sed 's / /! / g' | sed -n "/ $ (EXPR }/,/${ EXPR) / p" `

echo "EXTRAÍDO é: $ (EXTRAÍDO)"

Alguém pode me ajudar neste


Raghu
 

Marcadores

Thread Tools Pesquisar este Thread
Pesquisar este Thread:

Pesquisa Avançada
Display Modes Esta taxa Thread
Esta taxa Thread:

Destacamento Regimento
Você não pode postar novas threads
Você não pode postar respostas
Você não pode postar anexos
Você não pode editar suas postagens

BB code é Ligado
Smilies são Ligado
[IMG] código é Ligado
Código HTML é Desligado
Trackbacks são Ligado
Pingbacks são Ligado
Refbacks são Ligado




Todos os horários são GMT -4. A hora é agora 08:22.


Powered by: vBulletinCopyright © 2000 - 2006, Jelsoft Enterprises Limited. Língua Traduções Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
O UNIX e Linux Fóruns Content Copyright © 1993-2009. Todos os Direitos Reserved.Ad Gestão por RedTyger

Content Relevant URLs por vBSEO 3.2.0