The UNIX and Linux Forums  

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
fundir dois arquivos vakharia Mahesh Programação Shell Script e 7 09-15-2008 01:32
Mesclando arrays jakSun8 Programação Shell Script e 4 07-02-2008 12:13
Juntar dois arquivos venommaker UNIX para Dummies Perguntas & Respostas 4 01-10-2008 08:15
Mesclando info Manan Programação Shell Script e 3 05-20-2006 08:51
Mesclando Ajuda kumarc Programação Shell Script e 3 05-04-2006 03:24

 
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 01-05-2009
ssachins ssachins is offline
Usuário
  
 

Join Date: Jan 2009
Lugares: 29
Fusão de linhas

Oi gente,

Desejo a todos um Feliz Ano Novo!.

Thanks in advance.

Eu quero ler um arquivo e mesclar as linhas que têm '\ n' nele.
As linhas poderiam ser> 50.000 bytes. O script deve unir todas as linhas até a próxima linha começa com a palavra 'Tipo | ".
ex.
Tipo | Bilhetes | TradeID | 42224A | SystemID | DDDD61266 | SourceSystem | RMS | Versão | 5 | LatestVersionYN | Y | Counterpa rty | OB | DBLegalEntity | Londres | Notas | eventos adicionados cal | Vendedor | DHX | LastUpdated | Dez 2008 18:31 : 40 | Acção | Exp | DealCaptureSystem | Vendas | CustomerSourceSystem | RMS | Cliente | AUGS | ActionEffectiveDa te | DEC 2008 00:00:00 | BookingLocation | Londres | EnteredBy | GONU | MarkupAmt | 100 | MarkupCcy | KEX | PremiumCurrency | EUR | Premi umAmount | 000 | PremiumDate | Dez 2008 | PremiumHasPaidYN | N | BookingDetails | 9000/mihl
Cliente vende KEZUSD
ref ª 1,3724
Sele é alavancada em ST
52 Sele, começando


Tipo | FxDiscreteDNT | TradeID | SSA32553H | SystemID | GGT04481 | SourceSystem | RMS | SourceSystemBook | OT | Reserve | OT | BookBranchParent | Vá | Versão | 8 | LatestVersionYN | Y | Contraparte | Nascimento | Status | KnockedOut | IsLiveYN | N | DBLega lEntity | Londres | LastUpdated | Jan 2009 00:26:35 | Acção | KnockedOut | CounterpartySourcesystem | RMS | TradeDate | Jul 2006 | ProductID | KKI99106 | StructureID | DDS32553 | DealCaptureSystem | RMS | CustomerSourceSystem | RMS | Cliente | ESL | PricingSite | Opção | UnderCurrency1 | JPY | AccCurrency1 | E.U. | UpBarrier1 | 1.5 | LowBarrier1 | 1 | UnderCurrenc y2 | JPY | AccCurrency2 | CH | UpBarrier2 | 1.64 | LowBarrier2 | 1.49 | UnderCurrency3 | EUR | AccCurrency3 | JPY | UpBarrie r3 | 175 | LowBarrier3 | 105 | LastFixed

O outout deve ser
O registro deverá ser inferior em uma linha.

Tipo | Bilhetes | TradeID | 42224A | SystemID | DDDD61266 | SourceSystem | RMS | Versão | 5 | LatestVersionYN | Y | Counterpa rty | OB | DBLegalEntity | Londres | Notas | eventos adicionados cal | Vendedor | DHX | LastUpdated | Dez 2008 18:31 : 40 | Acção | Exp | DealCaptureSystem | Vendas | CustomerSourceSystem | RMS | Cliente | AUGS | ActionEffectiveDa te | DEC 2008 00:00:00 | BookingLocation | Londres | EnteredBy | GONU | MarkupAmt | 100 | MarkupCcy | KEX | PremiumCurrency | EUR | Premi umAmount | 000 | PremiumDate | Dez 2008 | PremiumHasPaidYN | N | BookingDetails | 9000/mihl clientes vende KEZUSD st ref 1,3724 alavancada Sele está em ST 52 Sele, começando

Tipo | FxDiscreteDNT | TradeID | SSA32553H | SystemID | GGT04481 | SourceSystem | RMS | Versão | 8 | LatestVersionYN | Y | Contraparte | Nascimento | DBLegalEntity | Londres | LastUpdated | Jan 2009 00:26:35 | Acção | KnockedOut | DealCaptureSystem | RMS | CustomerSourceSystem | RMS | Cliente | ESL | PricingSite | O ption | UnderCurrency1 | JPY | AccCurrency1 | E.U. | UnderCurrency3 | EUR | AccCurrency3 | JPY | UpBarrier3 | 175 | LowBarri er3 | 105 | LastFixed

Tentei usar abaixo mencionados Awk script, mas não pode manipular> 20.000 bytes. Além disso, usando como String 'LINE_BREAK' para identificar linhas tenho fundidos.

FileName \u003d LINE_TEST.TXT
Filename1 \u003d O_LINE_TEST.TXT
OUTPUT_FILE \u003d OUTPUT_WITHOUT_LINE_BREAK.tmp
if [[-e $ filename]] e, depois,
sed "s /% / percentual / g" $ filename> $ filename1
# # Para remover '%' como 'awk' não pode lidar com ela.

/ usr/xpg4/bin/awk 'NR \u003d\u003d 1 (printf $ 0;) próxima
! / ^ TradeType / (printf "LINE_BREAK" $ 0;) próxima
(printf "\ n" $ 0)
END (print "")
'$ Filename1> $ OUTPUT_FILE
fi
 

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 12:34.


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