[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SOLUÇÃO] linhas múltiplas de 4
From: |
Molinero |
Subject: |
[SOLUÇÃO] linhas múltiplas de 4 |
Date: |
Fri, 12 Dec 2008 17:14:14 -0200 |
User-agent: |
Thunderbird 2.0.0.17 (X11/20080914) |
Guilherme,
Funcionou mesmo !
Obrigado a você e a todos que responderam !
======================================
CyberCrow
Conhecimento é Poder !
Quando voce perde a mente limitada
Voce liberta a sua vida
http://cybercrow.blogspot.com
======================================
1. Try to find an answer by searching the archives of the forum you
plan to post to.
2. Try to find an answer by searching the Web.
3. Try to find an answer by reading the manual.
4. Try to find an answer by reading a FAQ.
5. Try to find an answer by inspection or experimentation.
6. Try to find an answer by asking a skilled friend.
7. If you're a programmer, try to find an answer by reading the
source code.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/L/U d- s-: a- C++ LSU++++ P+ L+++ E--- W++ N w--
O-- M- V- PS PE- Y PGP++ t 5 X++ R tv- b++ DI D+
G++ e- h* r y+
-------END GEEK CODE BLOCK------
Guilherme Gall wrote:
>
> Fiz o seguinte script em awk. Vê se ajuda:
>
> $ cat script.awk
> BEGIN{
> RS=""
> FS="\n"
> OFS="\n"
> }
>
> {
> sub(/email/, "email_alternativo", $4)
> print $0"\n"
> }
>
> $ awk -f script.awk arquivo_original.txt
> Nome: Nair
> Sobrenome: Silveira
> email: address@hidden <mailto:nsilveira%40dom.com>
> email_alternativo: address@hidden <mailto:nsilveira%40hotmail.com>
>
> Nome: Carlos
> Sobrenome: Martin
> email: address@hidden <mailto:carlos.martin%40dom.com>
> email_alternativo: address@hidden <mailto:cmartin87%40walla.net>
>
> Nome: Lucia
> Sobrenome: Andrade
> email: address@hidden <mailto:luciaa%40dom.com>
> email_alternativo: address@hidden <mailto:lucinha%40hotmail.com>
>
> Não consegui manter as linhas em branco em seus lugares originais,
> perceba que a primeira linha foi apagada e que uma linha em branco
> extra foi adicionada no final da saída. Acredito que o segredo está no
> uso adequado da variável ORS, mas não consegui fazer funcionar e ainda
> tive que concatenar um \n no final de cada registro para colocar uma
> linha em branco entre cada um.
>
> Se alguém mais experiente em awk puder dar uma idéia seria interessante.
>
> Saudações,
2008/12/11 Molinero <address@hidden
<mailto:cybercrowbr%40gmail.com>>:
> Pessoal,
> Gostaria de uma ajuda de vocês.
> Preciso fazer um script que leia um arquivo e de 4 em 4 linhas deste
> arquivo e altere uma parte desta linha.
> Ex.:
> Arquivo_Original.txt
> === linha em branco ===
> Nome: Nair
> Sobrenome: Silveira
> email: address@hidden <mailto:nsilveira%40dom.com>
> email: address@hidden <mailto:nsilveira%40hotmail.com>
> === linha em branco ===
> Nome: Carlos
> Sobrenome: Martin
> email: address@hidden <mailto:carlos.martin%40dom.com>
> email: address@hidden <mailto:cmartin87%40walla.net>
> === linha em branco ===
> Nome: Lucia
> Sobrenome: Andrade
> email: address@hidden <mailto:luciaa%40dom.com>
> email: address@hidden <mailto:lucinha%40hotmail.com>
> Quero alterar o segundo "email" para "email_alternativo", ficando então:
> Arquivo_Novo.txt
> === linha em branco ===
> Nome: Nair
> Sobrenome: Silveira
> email: address@hidden <mailto:nsilveira%40dom.com>
> email_alternativo: address@hidden <mailto:nsilveira%40hotmail.com>
> === linha em branco ===
> Nome: Carlos
> Sobrenome: Martin
> email: address@hidden <mailto:carlos.martin%40dom.com>
> email_alternativo: address@hidden <mailto:cmartin87%40walla.net>
> ... e por ai vai.
> Quebrei a cabeça e não consegui, por isso peço a ajuda de vcs.
> Agradeço desde já !!!
<!-- #ygrp-mkp{ border: 1px solid #d8d8d8; font-family:
Arial; margin: 14px 0px; padding: 0px 14px; } #ygrp-mkp hr{ border: 1px
solid #d8d8d8; } #ygrp-mkp #hd{ color: #628c2a; font-size: 85%;
font-weight: bold; line-height: 122%; margin: 10px 0px; } #ygrp-mkp
#ads{ margin-bottom: 10px; } #ygrp-mkp .ad{ padding: 0 0; } #ygrp-mkp
.ad a{ color: #0000ff; text-decoration: none; } --> <!-- #ygrp-sponsor
#ygrp-lc{ font-family: Arial; } #ygrp-sponsor #ygrp-lc #hd{ margin: 10px
0px; font-weight: bold; font-size: 78%; line-height: 122%; }
#ygrp-sponsor #ygrp-lc .ad{ margin-bottom: 10px; padding: 0 0; } -->
<!-- #ygrp-mlmsg {font-size:13px; font-family:
arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
#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;*font-size:100%;} #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-reco { margin-bottom: 20px; padding: 0px;
} #ygrp-reco #reco-head { font-weight: bold; color: #ff7900; }
#reco-grpname{ font-weight: bold; margin-top: 10px; } #reco-category{
font-size: 77%; } #reco-desc{ font-size: 77%; } #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} -->
- Re: [shell-script] Re: problema ao exporta váriaveis, (continued)
- Re: [shell-script] Re: problema ao exporta váriaveis, Breno Moiana, 2008/12/09
- Re: [shell-script] Re: problema ao exporta váriaveis, Julio C. Neves, 2008/12/09
- Re: problema ao exporta váriaveis, edmarssouza, 2008/12/09
- linhas múltiplas de 4, Molinero, 2008/12/11
- Re: linhas múltiplas de 4, Molinero, 2008/12/11
- Re: [shell-script] [MODERAÇÃO]Re: linhas múltiplas de 4, MrBiTS, 2008/12/14
- Re: linhas múltiplas de 4, marlon_mca, 2008/12/11
- Re: [shell-script] linhas múltiplas de 4, Guilherme Gall, 2008/12/11
- Re: [shell-script] linhas múltiplas de 4, miranda, 2008/12/12
- Re: [shell-script] linhas múltiplas de 4, Guilherme Gall, 2008/12/13
- [SOLUÇÃO] linhas múltiplas de 4,
Molinero <=
- Script rotas, Rafael Weber, 2008/12/13
- Re: [shell-script] Script rotas, Raul Libório, 2008/12/13
- Re: [shell-script] Script rotas, Rafael Weber, 2008/12/15