Discussion:
[shell-script] Sed imprimir a segunda linha na frente da primeira
Tiago Tarifa tiagotarifa@gmail.com [shell-script]
2017-04-21 22:15:52 UTC
Permalink
Boa noite pessoal!
Acho que minha dúvida é simples, mas estou quebrando a cabeça...

Eu quero que o sed transforme isso:
1
2
3
4
5
6
7
8
9
10

em isso:
2 1
4 3
6 5
8 7
10 9

Eu não sei se o sed é o melhor cara para fazer isso, mas estou tentando com
ele há algumas horas e não estou conseguindo... o máximo que consegui foi
este comando:
seq 1 10 | sed -r 'h;n;G; s/\n/ /'
Robson Alexandre alexandrerobson@gmail.com [shell-script]
2017-04-21 22:47:55 UTC
Permalink
Boa noite Tiago,

Só faltou vc usar a opção -n do sed e mandar imprimir (opção p) apenas a
saída q deseja


$ seq 10 | sed -n 'h;n;G;s/\n/ /p'
2 1
4 3
6 5
8 7
10 9


Atenciosamente
Robson Alexandre
Post by Tiago Tarifa ***@gmail.com [shell-script]
Boa noite pessoal!
Acho que minha dúvida é simples, mas estou quebrando a cabeça...
1
2
3
4
5
6
7
8
9
10
2 1
4 3
6 5
8 7
10 9
Eu não sei se o sed é o melhor cara para fazer isso, mas estou tentando
com ele há algumas horas e não estou conseguindo... o máximo que consegui
seq 1 10 | sed -r 'h;n;G; s/\n/ /'
--
Atenciosamente

Robson Alexandre
Raul Libório rauhmaru@gmail.com [shell-script]
2017-04-21 23:51:40 UTC
Permalink
Ah, perdão... Não observei que você quer com os números pares na primeira
coluna. Sorry! =\

Raul Libório
http://rauhmaru.blogspot.com/
openSUSE Member | Linux User #4444581

/etc/httpd/conf.d/ssl.conf:7
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
Lembrando que o comando paste também faz isso aí
1
2
3
4
5
6
7
8
9
10
1 2
3 4
5 6
7 8
9 10
Raul Libório
http://rauhmaru.blogspot.com/
openSUSE Member | Linux User #4444581
/etc/httpd/conf.d/ssl.conf:7
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are
unsure
# consult the online docs. You have been warned.
Post by Robson Alexandre ***@gmail.com [shell-script]
Boa noite Tiago,
Só faltou vc usar a opção -n do sed e mandar imprimir (opção p) apenas a
saída q deseja
$ seq 10 | sed -n 'h;n;G;s/\n/ /p'
2 1
4 3
6 5
8 7
10 9
Atenciosamente
Robson Alexandre
Post by Tiago Tarifa ***@gmail.com [shell-script]
Boa noite pessoal!
Acho que minha dúvida é simples, mas estou quebrando a cabeça...
1
2
3
4
5
6
7
8
9
10
2 1
4 3
6 5
8 7
10 9
Eu não sei se o sed é o melhor cara para fazer isso, mas estou tentando
com ele há algumas horas e não estou conseguindo... o máximo que consegui
seq 1 10 | sed -r 'h;n;G; s/\n/ /'
--
Atenciosamente
Robson Alexandre
Tiago Tarifa tiagotarifa@gmail.com [shell-script]
2017-04-22 02:22:13 UTC
Permalink
Legal Robson, muito obrigado!
Resolveu minha vida aqui. :)
Post by Raul Libório ***@gmail.com [shell-script]
Ah, perdão... Não observei que você quer com os números pares na primeira
coluna. Sorry! =\
Raul Libório
http://rauhmaru.blogspot.com/
openSUSE Member | Linux User #4444581
/etc/httpd/conf.d/ssl.conf:7
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
Lembrando que o comando paste também faz isso aí
1
2
3
4
5
6
7
8
9
10
1 2
3 4
5 6
7 8
9 10
Raul Libório
http://rauhmaru.blogspot.com/
openSUSE Member | Linux User #4444581
/etc/httpd/conf.d/ssl.conf:7
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
Post by Robson Alexandre ***@gmail.com [shell-script]
Boa noite Tiago,
Só faltou vc usar a opção -n do sed e mandar imprimir (opção p) apenas a
saída q deseja
$ seq 10 | sed -n 'h;n;G;s/\n/ /p'
2 1
4 3
6 5
8 7
10 9
Atenciosamente
Robson Alexandre
Post by Tiago Tarifa ***@gmail.com [shell-script]
Boa noite pessoal!
Acho que minha dúvida é simples, mas estou quebrando a cabeça...
1
2
3
4
5
6
7
8
9
10
2 1
4 3
6 5
8 7
10 9
Eu não sei se o sed é o melhor cara para fazer isso, mas estou tentando
com ele há algumas horas e não estou conseguindo... o máximo que consegui
seq 1 10 | sed -r 'h;n;G; s/\n/ /'
--
Atenciosamente
Robson Alexandre
itamarnet@yahoo.com.br [shell-script]
2017-04-22 09:59:07 UTC
Permalink
Tiago

A solução do Robson é perfeita, mas apenas vou dar um pitaco com awk:

seq 10 | awk '{getline par; print par, $0}'
ou
seq 10 | awk 'NR%2!=0 {impar=$0}; NR%2==0{print $0, impar}'

[]'s
Itamar
Tiago Tarifa tiagotarifa@gmail.com [shell-script]
2017-04-23 14:22:33 UTC
Permalink
Itamar,
Legal essa solução em awk. Por enquanto estou estudando sed e bash4 mas em
breve estudarei o awk.
Você tem alguma sugestão de literatura ou algo do tipo para eu estudar o
awk além do livro do Julio?

Valeu!
Post by ***@yahoo.com.br [shell-script]
Tiago
seq 10 | awk '{getline par; print par, $0}'
ou
seq 10 | awk 'NR%2!=0 {impar=$0}; NR%2==0{print $0, impar}'
[]'s
Itamar
laomonteiro laomonteiro@yahoo.com.br [shell-script]
2017-04-23 22:53:48 UTC
Permalink
Effective awk Programming. autor Arnold Robbins editora O'Reily, tenho o original em inglês 3 edição, excelente, nao sei se ja tem em português. Ja saiu a 4 edição em inglês 



Enviado do meu smartphone Samsung Galaxy.
-------- Mensagem original --------De: "Tiago Tarifa ***@gmail.com [shell-script]" <shell-***@yahoogrupos.com.br> Data: 23/04/17 11:22 (GMT-03:00) Para: shell-***@yahoogrupos.com.br Assunto: Re: [shell-script] Sed imprimir a segunda linha na frente da primeira

 









Itamar,
Legal essa solução em awk. Por enquanto estou estudando sed e bash4 mas em breve estudarei o awk.
Você tem alguma sugestão de literatura ou algo do tipo para eu estudar o awk além do livro do Julio?

Valeu!

Em 22 de abril de 2017 06:59, ***@yahoo.com.br [shell-script] <shell-***@yahoogrupos.com.br> escreveu:















 









Tiago

A solução do Robson é perfeita, mas apenas vou dar um pitaco com awk:

seq 10 | awk '{getline par; print par, $0}'
ou
seq 10 | awk 'NR%2!=0 {impar=$0}; NR%2==0{print $0, impar}'

[]'s
Itamar
itamarnet@yahoo.com.br [shell-script]
2017-04-23 23:41:22 UTC
Permalink
Caro Tiago

Em termos de livro em português o do Julio com certeza é o que eu mais recomendo.

A sugestão do laomonteiro é excelente, e também recomendo.

Mas nada melhor que a fonte original, em inglês, sobre gawk (versão GNU):

https://www.gnu.org/software/gawk/manual/ https://www.gnu.org/software/gawk/manual/

É so se divertir

[]'s
Itamar
Tiago Tarifa tiagotarifa@gmail.com [shell-script]
2017-04-24 12:17:13 UTC
Permalink
eu divertir-me-ei

*.*
Obrigado a todos.
Post by ***@yahoo.com.br [shell-script]
Caro Tiago
Em termos de livro em português o do Julio com certeza é o que eu mais recomendo.
A sugestão do laomonteiro é excelente, e também recomendo.
https://www.gnu.org/software/gawk/manual/
É so se divertir
[]'s
Itamar
Dito Ramos diramos@uol.com.br [shell-script]
2017-05-02 14:34:31 UTC
Permalink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>







<body style="background-color: #fff;">
<span style="display:none">&nbsp;</span>

<!--~-|**|PrettyHtmlStartT|**|-~-->
<div id="ygrp-mlmsg" style="position:relative;">
<div id="ygrp-msg" style="z-index: 1;">
<!--~-|**|PrettyHtmlEndT|**|-~-->

<div id="ygrp-text" >


<p>&nbsp;
<p><!-- |**|end egp html banner|**| -->Mestres,<br>
Eu me aposentei do servi&ccedil;o e dei uma &quot;travada&quot; aqui em shell script.<br>
Agora estou, aos poucos, voltando a dar uma mexida.<br>
Portanto, perdoem se a quest&atilde;o &eacute; muito &quot;boba&quot;<br>
Vamos l&aacute;:<br>
Preciso imprimir de 1 a 500, somente n&uacute;meros pares.<br>
At&eacute; a&iacute;, tudo bem. Fiz assim:<br>
<br>
#!/bin/bash<br>
for ((i=1;i&lt;501;i&#43;+))<br>
do<br>
&nbsp;(( $i % 2 == 0 )) &amp;&amp; echo $i<br>
done<br>
<br>
Por&eacute;m, preciso imprimir essa sequ&ecirc;ncia randomicamente, mas sem repetir nenhum n&uacute;mero, de forma que me seja retornado os 250 n&uacute;meros da cadeia.<br>
Sei que tem a vari&aacute;vel $random. Mas n&atilde;o estou sabendo usar para este caso.<br>
Podem ajudar?<br>
<br>
Grato<br>
<br>
Dito Ramos&nbsp;<br>
&nbsp;</p>
</p>

</div>


<!--~-|**|PrettyHtmlStart|**|-~-->
<div style="color: #fff; height: 0;">__._,_.___</div>






<div style="clear:both"> </div>

<div id="fromDMARC" style="margin-top: 10px;">
<hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
Enviado por: Dito Ramos &lt;***@uol.com.br&gt; <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
</div>
<div style="clear:both"> </div>

<table cellspacing=4px style="margin-top: 10px; margin-bottom: 10px; color: #2D50FD;">
<tbody>
<tr>
<td style="font-size: 12px; font-family: arial; font-weight: bold; padding: 7px 5px 5px;" >
<a style="text-decoration: none; color: #2D50FD" href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/messages/40117;_ylc=X3oDMTJxbW0zaDU5BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTE3BHNlYwNmdHIEc2xrA3JwbHkEc3RpbWUDMTQ5MzczNTY3Ng--?act=reply&messageNum=40117">Responder através da web</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="mailto:***@uol.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD;">
</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;">
<a href="mailto:shell-***@yahoogrupos.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD">
através de email </a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/newtopic;_ylc=X3oDMTJlcm01cmZxBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTQ5MzczNTY3Ng--" style="text-decoration: none; color: #2D50FD">Adicionar um novo tópico</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;color: #2D50FD;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/topics/40117;_ylc=X3oDMTM2OHI4dWhzBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTE3BHNlYwNmdHIEc2xrA3Z0cGMEc3RpbWUDMTQ5MzczNTY3NgR0cGNJZAM0MDExNw--" style="text-decoration: none; color: #2D50FD;">Mensagens neste tópico</a>
(1)
</td>
</tr>
</tbody>
</table>



<!------- Start Nav Bar ------>
<!-- |**|begin egp html banner|**| -->
<!-- |**|end egp html banner|**| -->


<div id="ygrp-grfd" style="font-family: Verdana; font-size: 12px; padding: 15px 0;">

<!-- |**|begin egp html banner|**| -->

---------------------------------------------------------------------<BR>
Esta lista não admite a abordagem de outras liguagens de programação, como perl, C etc. Quem insistir em não seguir esta regra será moderado sem prévio aviso.<BR>
---------------------------------------------------------------------<BR>
Sair da lista: shell-script-***@yahoogrupos.com.br<BR>
---------------------------------------------------------------------<BR>
Esta lista é moderada de acordo com o previsto em <a href="http://www.listas-discussao.cjb.net">http://www.listas-discussao.cjb.net</a><BR>
---------------------------------------------------------------------<BR>
Servidor Newsgroup da lista: news.gmane.org<BR>
Grupo: gmane.org.user-groups.programming.shell.brazil<BR>
<BR>

<!-- |**|end egp html banner|**| -->

</div>




<!-- |**|begin egp html banner|**| -->
<div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

<span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; "><a href="https://br.groups.yahoo.com/neo/groups/shell-script/info;_ylc=X3oDMTJlam01aHQ4BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ5MzczNTY3Ng--" style="text-decoration: none;">Visite seu Grupo</a></span>

<ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
</ul>
</div>


<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
<a href="https://br.groups.yahoo.com/neo;_ylc=X3oDMTJkNmhsY3A1BF9TAzk3NDkwNDM1BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDkzNzM1Njc2" style="float: left;"><img src="Loading Image..." height="19" width="141" alt="Yahoo! Grupos" style="border: 0;"/></a>
<div style="color: #747575; float: right;"> &bull; <a href="https://info.yahoo.com/privacy/br/yahoo/groups/details.html" style="text-decoration: none;">Privacidade</a> &bull; <a href="mailto:shell-script-***@yahoogrupos.com.br?subject=Sair do grupo" style="text-decoration: none;">Sair do grupo</a> &bull; <a href="https://info.yahoo.com/legal/br/yahoo/utos/terms/" style="text-decoration: none;">Termos de uso</a> </div>
</div>
<br>

<!-- |**|end egp html banner|**| -->

</div> <!-- ygrp-msg -->


<!-- Sponsor -->
<!-- |**|begin egp html banner|**| -->
<div id="ygrp-sponsor" style="width:160px; float:right; clear:none; margin:0 0 25px 0; background: #fff;">

<!-- Start Recommendations -->
<div id="ygrp-reco">
</div>
<!-- End Recommendations -->



</div> <!-- |**|end egp html banner|**| -->

<div style="clear:both; color: #FFF; font-size:1px;">.</div>
</div>

<img src="http://geo.yahoo.com/serv?s=97490437/grpId=1941312/grpspId=2137111254/msgId=40117/stime=1493735676" width="1" height="1"> <br>

<img src="http://y.analytics.yahoo.com/fpc.pl?ywarid=515FB27823A7407E&a=10001310322279&js=no&resp=img" width="1" height="1">

<div style="color: #fff; height: 0;">__,_._,___</div>
<!--~-|**|PrettyHtmlEnd|**|-~-->

</body>

<!--~-|**|PrettyHtmlStart|**|-~-->
<head>
<style type="text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}

#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}

#ygrp-mkp #ads {
margin-bottom: 10px;
}

#ygrp-mkp .ad {
padding: 0 0;
}

#ygrp-mkp .ad p {
margin: 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: 700;
font-size: 78%;
line-height: 122%;
}

#ygrp-sponsor #ygrp-lc .ad {
margin-bottom: 10px;
padding: 0 0;
}

#actions {
font-family: Verdana;
font-size: 11px;
padding: 10px 0;
}

#activity {
background-color: #e0ecee;
float: left;
font-family: Verdana;
font-size: 10px;
padding: 10px;
}

#activity span {
font-weight: 700;
}

#activity span:first-child {
text-transform: uppercase;
}

#activity span a {
color: #5085b6;
text-decoration: none;
}

#activity span span {
color: #ff7900;
}

#activity span .underline {
text-decoration: underline;
}

.attach {
clear: both;
display: table;
font-family: Arial;
font-size: 12px;
padding: 10px 0;
width: 400px;
}

.attach div a {
text-decoration: none;
}

.attach img {
border: none;
padding-right: 5px;
}

.attach label {
display: block;
margin-bottom: 5px;
}

.attach label a {
text-decoration: none;
}

blockquote {
margin: 0 0 0 4px;
}

.bold {
font-family: Arial;
font-size: 13px;
font-weight: 700;
}

.bold a {
text-decoration: none;
}

dd.last p a {
font-family: Verdana;
font-weight: 700;
}

dd.last p span {
margin-right: 10px;
font-family: Verdana;
font-weight: 700;
}

dd.last p span.yshortcuts {
margin-right: 0;
}

div.attach-table div div a {
text-decoration: none;
}

div.attach-table {
width: 400px;
}

div.file-title a, div.file-title a:active, div.file-title a:hover, div.file-title a:visited {
text-decoration: none;
}

div.photo-title a, div.photo-title a:active, div.photo-title a:hover, div.photo-title a:visited {
text-decoration: none;
}

div#ygrp-mlmsg #ygrp-msg p a span.yshortcuts {
font-family: Verdana;
font-size: 10px;
font-weight: normal;
}

.green {
color: #628c2a;
}

.MsoNormal {
margin: 0 0 0 0;
}

o {
font-size: 0;
}

#photos div {
float: left;
width: 72px;
}

#photos div div {
border: 1px solid #666666;
height: 62px;
overflow: hidden;
width: 62px;
}

#photos div label {
color: #666666;
font-size: 10px;
overflow: hidden;
text-align: center;
white-space: nowrap;
width: 64px;
}

#reco-category {
font-size: 77%;
}

#reco-desc {
font-size: 77%;
}

.replbq {
margin: 4px;
}

#ygrp-actbar div a:first-child {
/* border-right: 0px solid #000;*/
margin-right: 2px;
padding-right: 5px;
}

#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-mlmsg #logo {
padding-bottom: 10px;
}


#ygrp-msg p a {
font-family: Verdana;
}

#ygrp-msg p#attach-count span {
color: #1E66AE;
font-weight: 700;
}

#ygrp-reco #reco-head {
color: #ff7900;
font-weight: 700;
}

#ygrp-reco {
margin-bottom: 20px;
padding: 0px;
}

#ygrp-sponsor #ov li a {
font-size: 130%;
text-decoration: none;
}

#ygrp-sponsor #ov li {
font-size: 77%;
list-style-type: square;
padding: 6px 0;
}

#ygrp-sponsor #ov ul {
margin: 0;
padding: 0 0 0 8px;
}

#ygrp-text {
font-family: Georgia;
}

#ygrp-text p {
margin: 0 0 1em 0;
}

#ygrp-text tt {
font-size: 120%;
}

#ygrp-vital ul li:last-child {
border-right: none !important;
}
-->
</style>
</head>

<!--~-|**|PrettyHtmlEnd|**|-~-->
</html>
<!-- end group email -->
Alfredo Casanova atcasanova@gmail.com [shell-script]
2017-05-02 14:38:56 UTC
Permalink
Dito, vc pode fazer a primeira tarefa usando a seguinte construção:
echo {0..500..2}

Isso vai imprimir os numeros de 0 a 500 com incremento de 2.

Para "embaralhar" todos, eu faria:

echo {0..500..2} | tr ' ' '\n' | shuf
Post by Dito Ramos ***@uol.com.br [shell-script]
Mestres,
Eu me aposentei do serviço e dei uma "travada" aqui em shell script.
Agora estou, aos poucos, voltando a dar uma mexida.
Portanto, perdoem se a questão é muito "boba"
Preciso imprimir de 1 a 500, somente números pares.
#!/bin/bash
for ((i=1;i<501;i++))
do
(( $i % 2 == 0 )) && echo $i
done
Porém, preciso imprimir essa sequência randomicamente, mas sem repetir
nenhum número, de forma que me seja retornado os 250 números da cadeia.
Sei que tem a variável $random. Mas não estou sabendo usar para este caso.
Podem ajudar?
Grato
Dito Ramos
Dito Ramos diramos@uol.com.br [shell-script]
2017-05-02 14:51:37 UTC
Permalink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>







<body style="background-color: #fff;">
<span style="display:none">&nbsp;</span>

<!--~-|**|PrettyHtmlStartT|**|-~-->
<div id="ygrp-mlmsg" style="position:relative;">
<div id="ygrp-msg" style="z-index: 1;">
<!--~-|**|PrettyHtmlEndT|**|-~-->

<div id="ygrp-text" >


<p>Boa, Itamar. Funcionou, em partes.<br>
S&oacute; que eu preciso armazenar $i para usar futuramente, entende?<br>
Na pr&aacute;tica, tenho um diret&oacute;rio com 250 arquivos .mp3. Ex:<br>
<br>
Vin&iacute;cius de Moraes - Garota de Ipanema.mp3<br>
Chico Buarque - Constru&ccedil;&atilde;o.mp3<br>
John Lennon - Imagine.mp3<br>
..... e assim por diante.<br>
<br>
Quero pegar $i do la&ccedil;o l&aacute; e renomear os arquivos pr&aacute; que fiquem assim, por exemplo:<br>
<br>
202 - Vin&iacute;cius de Moraes - Garota de Ipanema.mp3<br>
050 - hico Buarque - Constru&ccedil;&atilde;o.mp3<br>
002 - John Lennon - Imagine.mp3<br>
... e assim por diante.<br>
<br>
Por isso &eacute; importante manter o la&ccedil;o for l&aacute;, entende?<br>
<br>
Mas mesmo assim, agrade&ccedil;o.<br>
<br>
Dito <hr> <div><br> <strong>De: </strong>&quot;Alfredo Casanova ***@gmail.com [shell-script]&quot; &lt;shell-***@yahoogrupos.com.br&gt;<br>
<strong>Enviada: </strong>2017/05/02 11:39:12<br>
<strong>Para: </strong>shell-***@yahoogrupos.com.br<br>
<strong>Assunto: </strong> Re: [shell-script] Imprimir sequ&ecirc;ncia de n&uacute;meros randomicamente, SEM REPETI&Ccedil;&Atilde;O<br>
&nbsp;</div>
<span>&nbsp;</span>
<div id="ygrp-text">
<p>&nbsp;</p>

<div dir="ltr">Dito, vc pode fazer a primeira tarefa usando a seguinte constru&ccedil;&atilde;o:<br>
echo {0..500..2}
<div>&nbsp;</div>

<div>Isso vai imprimir os numeros de 0 a 500 com incremento de 2.</div>

<div>&nbsp;</div>

<div>Para &quot;embaralhar&quot; todos, eu faria:</div>

<div>&nbsp;</div>

<div>echo {0..500..2} | tr &#39; &#39; &#39;\n&#39; | shuf</div>
</div>
&nbsp; <div class="gmail_quote"> <div dir="ltr">On Tue, May 2, 2017 at 11:34 AM Dito Ramos <a href="/compose?to=***@uol.com.br" target="_blank">***@uol.com.br</a> [shell-script] &lt;<a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt; wrote:</div>

<blockquote class="gmail_quote" style="border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div style="background-color: rgb(255, 255, 255);"><span>&nbsp;</span>

<div id="m_7183178578860059162ygrp-mlmsg">
<div id="m_7183178578860059162ygrp-msg">
<div id="m_7183178578860059162ygrp-text">
<p>&nbsp;</p>

<p>Mestres,<br>
Eu me aposentei do servi&ccedil;o e dei uma &quot;travada&quot; aqui em shell script.<br>
Agora estou, aos poucos, voltando a dar uma mexida.<br>
Portanto, perdoem se a quest&atilde;o &eacute; muito &quot;boba&quot;<br>
Vamos l&aacute;:<br>
Preciso imprimir de 1 a 500, somente n&uacute;meros pares.<br>
At&eacute; a&iacute;, tudo bem. Fiz assim:<br>
<br>
#!/bin/bash<br>
for ((i=1;i&lt;501;i&#43;+))<br>
do<br>
&nbsp;(( $i % 2 == 0 )) &amp;&amp; echo $i<br>
done<br>
<br>
Por&eacute;m, preciso imprimir essa sequ&ecirc;ncia randomicamente, mas sem repetir nenhum n&uacute;mero, de forma que me seja retornado os 250 n&uacute;meros da cadeia.<br>
Sei que tem a vari&aacute;vel $random. Mas n&atilde;o estou sabendo usar para este caso.<br>
Podem ajudar?<br>
<br>
Grato<br>
<br>
Dito Ramos&nbsp;<br>
&nbsp;</p>

<p>&nbsp;</p>
</div>

<div style="height: 0px;color: rgb(255, 255, 255);">&nbsp;</div>
</div>
</div>
</div>
</blockquote>
</div>

<p>&nbsp;</p>
</div>
<!-- end group email -->
</p>

</div>


<!--~-|**|PrettyHtmlStart|**|-~-->
<div style="color: #fff; height: 0;">__._,_.___</div>






<div style="clear:both"> </div>

<div id="fromDMARC" style="margin-top: 10px;">
<hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
Enviado por: Dito Ramos &lt;***@uol.com.br&gt; <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
</div>
<div style="clear:both"> </div>

<table cellspacing=4px style="margin-top: 10px; margin-bottom: 10px; color: #2D50FD;">
<tbody>
<tr>
<td style="font-size: 12px; font-family: arial; font-weight: bold; padding: 7px 5px 5px;" >
<a style="text-decoration: none; color: #2D50FD" href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/messages/40119;_ylc=X3oDMTJxdmVpOTMzBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTE5BHNlYwNmdHIEc2xrA3JwbHkEc3RpbWUDMTQ5MzczNjcwMA--?act=reply&messageNum=40119">Responder através da web</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="mailto:***@uol.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD;">
</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;">
<a href="mailto:shell-***@yahoogrupos.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD">
através de email </a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/newtopic;_ylc=X3oDMTJlY2oxaXB1BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTQ5MzczNjcwMA--" style="text-decoration: none; color: #2D50FD">Adicionar um novo tópico</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;color: #2D50FD;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/topics/40117;_ylc=X3oDMTM2MjN2YmVvBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTE5BHNlYwNmdHIEc2xrA3Z0cGMEc3RpbWUDMTQ5MzczNjcwMAR0cGNJZAM0MDExNw--" style="text-decoration: none; color: #2D50FD;">Mensagens neste tópico</a>
(3)
</td>
</tr>
</tbody>
</table>



<!------- Start Nav Bar ------>
<!-- |**|begin egp html banner|**| -->
<!-- |**|end egp html banner|**| -->


<div id="ygrp-grfd" style="font-family: Verdana; font-size: 12px; padding: 15px 0;">

<!-- |**|begin egp html banner|**| -->

---------------------------------------------------------------------<BR>
Esta lista não admite a abordagem de outras liguagens de programação, como perl, C etc. Quem insistir em não seguir esta regra será moderado sem prévio aviso.<BR>
---------------------------------------------------------------------<BR>
Sair da lista: shell-script-***@yahoogrupos.com.br<BR>
---------------------------------------------------------------------<BR>
Esta lista é moderada de acordo com o previsto em <a href="http://www.listas-discussao.cjb.net">http://www.listas-discussao.cjb.net</a><BR>
---------------------------------------------------------------------<BR>
Servidor Newsgroup da lista: news.gmane.org<BR>
Grupo: gmane.org.user-groups.programming.shell.brazil<BR>
<BR>

<!-- |**|end egp html banner|**| -->

</div>




<!-- |**|begin egp html banner|**| -->
<div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

<span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; "><a href="https://br.groups.yahoo.com/neo/groups/shell-script/info;_ylc=X3oDMTJlOGZhOTg3BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ5MzczNjcwMA--" style="text-decoration: none;">Visite seu Grupo</a></span>

<ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
</ul>
</div>


<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
<a href="https://br.groups.yahoo.com/neo;_ylc=X3oDMTJka3VzcmU2BF9TAzk3NDkwNDM1BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDkzNzM2NzAw" style="float: left;"><img src="http://l.yimg.com/ru/static/images/yg/img/email/new_logo/yahoo_groups_pt-BR_141x19.png" height="19" width="141" alt="Yahoo! Grupos" style="border: 0;"/></a>
<div style="color: #747575; float: right;"> &bull; <a href="https://info.yahoo.com/privacy/br/yahoo/groups/details.html" style="text-decoration: none;">Privacidade</a> &bull; <a href="mailto:shell-script-***@yahoogrupos.com.br?subject=Sair do grupo" style="text-decoration: none;">Sair do grupo</a> &bull; <a href="https://info.yahoo.com/legal/br/yahoo/utos/terms/" style="text-decoration: none;">Termos de uso</a> </div>
</div>
<br>

<!-- |**|end egp html banner|**| -->

</div> <!-- ygrp-msg -->


<!-- Sponsor -->
<!-- |**|begin egp html banner|**| -->
<div id="ygrp-sponsor" style="width:160px; float:right; clear:none; margin:0 0 25px 0; background: #fff;">

<!-- Start Recommendations -->
<div id="ygrp-reco">
</div>
<!-- End Recommendations -->



</div> <!-- |**|end egp html banner|**| -->

<div style="clear:both; color: #FFF; font-size:1px;">.</div>
</div>

<img src="http://geo.yahoo.com/serv?s=97490437/grpId=1941312/grpspId=2137111254/msgId=40119/stime=1493736700" width="1" height="1"> <br>

<img src="http://y.analytics.yahoo.com/fpc.pl?ywarid=515FB27823A7407E&a=10001310322279&js=no&resp=img" width="1" height="1">

<div style="color: #fff; height: 0;">__,_._,___</div>
<!--~-|**|PrettyHtmlEnd|**|-~-->

</body>

<!--~-|**|PrettyHtmlStart|**|-~-->
<head>
<style type="text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}

#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}

#ygrp-mkp #ads {
margin-bottom: 10px;
}

#ygrp-mkp .ad {
padding: 0 0;
}

#ygrp-mkp .ad p {
margin: 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: 700;
font-size: 78%;
line-height: 122%;
}

#ygrp-sponsor #ygrp-lc .ad {
margin-bottom: 10px;
padding: 0 0;
}

#actions {
font-family: Verdana;
font-size: 11px;
padding: 10px 0;
}

#activity {
background-color: #e0ecee;
float: left;
font-family: Verdana;
font-size: 10px;
padding: 10px;
}

#activity span {
font-weight: 700;
}

#activity span:first-child {
text-transform: uppercase;
}

#activity span a {
color: #5085b6;
text-decoration: none;
}

#activity span span {
color: #ff7900;
}

#activity span .underline {
text-decoration: underline;
}

.attach {
clear: both;
display: table;
font-family: Arial;
font-size: 12px;
padding: 10px 0;
width: 400px;
}

.attach div a {
text-decoration: none;
}

.attach img {
border: none;
padding-right: 5px;
}

.attach label {
display: block;
margin-bottom: 5px;
}

.attach label a {
text-decoration: none;
}

blockquote {
margin: 0 0 0 4px;
}

.bold {
font-family: Arial;
font-size: 13px;
font-weight: 700;
}

.bold a {
text-decoration: none;
}

dd.last p a {
font-family: Verdana;
font-weight: 700;
}

dd.last p span {
margin-right: 10px;
font-family: Verdana;
font-weight: 700;
}

dd.last p span.yshortcuts {
margin-right: 0;
}

div.attach-table div div a {
text-decoration: none;
}

div.attach-table {
width: 400px;
}

div.file-title a, div.file-title a:active, div.file-title a:hover, div.file-title a:visited {
text-decoration: none;
}

div.photo-title a, div.photo-title a:active, div.photo-title a:hover, div.photo-title a:visited {
text-decoration: none;
}

div#ygrp-mlmsg #ygrp-msg p a span.yshortcuts {
font-family: Verdana;
font-size: 10px;
font-weight: normal;
}

.green {
color: #628c2a;
}

.MsoNormal {
margin: 0 0 0 0;
}

o {
font-size: 0;
}

#photos div {
float: left;
width: 72px;
}

#photos div div {
border: 1px solid #666666;
height: 62px;
overflow: hidden;
width: 62px;
}

#photos div label {
color: #666666;
font-size: 10px;
overflow: hidden;
text-align: center;
white-space: nowrap;
width: 64px;
}

#reco-category {
font-size: 77%;
}

#reco-desc {
font-size: 77%;
}

.replbq {
margin: 4px;
}

#ygrp-actbar div a:first-child {
/* border-right: 0px solid #000;*/
margin-right: 2px;
padding-right: 5px;
}

#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-mlmsg #logo {
padding-bottom: 10px;
}


#ygrp-msg p a {
font-family: Verdana;
}

#ygrp-msg p#attach-count span {
color: #1E66AE;
font-weight: 700;
}

#ygrp-reco #reco-head {
color: #ff7900;
font-weight: 700;
}

#ygrp-reco {
margin-bottom: 20px;
padding: 0px;
}

#ygrp-sponsor #ov li a {
font-size: 130%;
text-decoration: none;
}

#ygrp-sponsor #ov li {
font-size: 77%;
list-style-type: square;
padding: 6px 0;
}

#ygrp-sponsor #ov ul {
margin: 0;
padding: 0 0 0 8px;
}

#ygrp-text {
font-family: Georgia;
}

#ygrp-text p {
margin: 0 0 1em 0;
}

#ygrp-text tt {
font-size: 120%;
}

#ygrp-vital ul li:last-child {
border-right: none !important;
}
-->
</style>
</head>

<!--~-|**|PrettyHtmlEnd|**|-~-->
</html>
<!-- end group email -->
Alfredo Casanova atcasanova@gmail.com [shell-script]
2017-05-02 14:58:37 UTC
Permalink
Dito, olha isso:

criei uma lista com 399 "musicas":
$ wc -l lista
399 lista

então fiz:
paste -d- <(echo {1..399} | tr ' ' '\n' | shuf) <(cat lista)
57-Vinícius de Moraes - Garota de Ipanema.mp3
198-Chico Buarque - Construção.mp3
83-John Lennon - Imagine.mp3
272-Vinícius de Moraes - Garota de Ipanema.mp3
278-Chico Buarque - Construção.mp3
106-John Lennon - Imagine.mp3
234-Vinícius de Moraes - Garota de Ipanema.mp3
308-Chico Buarque - Construção.mp3
355-John Lennon - Imagine.mp3
292-Vinícius de Moraes - Garota de Ipanema.mp3
20-Chico Buarque - Construção.mp3
165-John Lennon - Imagine.mp3
315-Vinícius de Moraes - Garota de Ipanema.mp3
275-Chico Buarque - Construção.mp3
366-John Lennon - Imagine.mp3
280-Vinícius de Moraes - Garota de Ipanema.mp3
16-Chico Buarque - Construção.mp3
8-John Lennon - Imagine.mp3
251-Vinícius de Moraes - Garota de Ipanema.mp3
3-Chico Buarque - Construção.mp3
382-John Lennon - Imagine.mp3

e por aí vai
Post by Dito Ramos ***@uol.com.br [shell-script]
Boa, Itamar. Funcionou, em partes.
Só que eu preciso armazenar $i para usar futuramente, entende?
Vinícius de Moraes - Garota de Ipanema.mp3
Chico Buarque - Construção.mp3
John Lennon - Imagine.mp3
..... e assim por diante.
Quero pegar $i do laço lá e renomear os arquivos prá que fiquem assim, por
202 - Vinícius de Moraes - Garota de Ipanema.mp3
050 - hico Buarque - Construção.mp3
002 - John Lennon - Imagine.mp3
... e assim por diante.
Por isso é importante manter o laço for lá, entende?
Mas mesmo assim, agradeço.
Dito
------------------------------
*Enviada: *2017/05/02 11:39:12
*Assunto: * Re: [shell-script] Imprimir sequência de números
randomicamente, SEM REPETIÇÃO
echo {0..500..2}
Isso vai imprimir os numeros de 0 a 500 com incremento de 2.
echo {0..500..2} | tr ' ' '\n' | shuf
Post by Dito Ramos ***@uol.com.br [shell-script]
Mestres,
Eu me aposentei do serviço e dei uma "travada" aqui em shell script.
Agora estou, aos poucos, voltando a dar uma mexida.
Portanto, perdoem se a questão é muito "boba"
Preciso imprimir de 1 a 500, somente números pares.
#!/bin/bash
for ((i=1;i<501;i++))
do
(( $i % 2 == 0 )) && echo $i
done
Porém, preciso imprimir essa sequência randomicamente, mas sem repetir
nenhum número, de forma que me seja retornado os 250 números da cadeia.
Sei que tem a variável $random. Mas não estou sabendo usar para este caso.
Podem ajudar?
Grato
Dito Ramos
Dito Ramos diramos@uol.com.br [shell-script]
2017-05-02 15:11:31 UTC
Permalink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>







<body style="background-color: #fff;">
<span style="display:none">&nbsp;</span>

<!--~-|**|PrettyHtmlStartT|**|-~-->
<div id="ygrp-mlmsg" style="position:relative;">
<div id="ygrp-msg" style="z-index: 1;">
<!--~-|**|PrettyHtmlEndT|**|-~-->

<div id="ygrp-text" >


<p>Casanova, Leslie e Itamar.<br>
Atrav&eacute;s de suas preciosas sugest&otilde;es, j&aacute; consegui chegar a uma solu&ccedil;&atilde;o para o caso.<br>
MUITO obrigado mais uma vez a todos.<br>
<br>
Dito <hr> <div><br> <strong>De: </strong>&quot;Alfredo Casanova ***@gmail.com [shell-script]&quot; &lt;shell-***@yahoogrupos.com.br&gt;<br>
<strong>Enviada: </strong>2017/05/02 12:05:18<br>
<strong>Para: </strong>shell-***@yahoogrupos.com.br<br>
<strong>Assunto: </strong> Re: [shell-script] Imprimir sequ&ecirc;ncia de n&uacute;meros randomicamente, SEM REPETI&Ccedil;&Atilde;O<br>
&nbsp;</div>
<span>&nbsp;</span>
<div id="ygrp-text">
<p>&nbsp;</p>

<div dir="ltr">Dito, olha isso:&nbsp;
<div>&nbsp;</div>

<div>criei uma lista com 399 &quot;musicas&quot;:</div>

<div>$ wc -l lista&nbsp;</div>

<div>399 lista</div>

<div>&nbsp;</div>

<div>ent&atilde;o fiz:&nbsp;</div>

<div>paste -d- &lt;(echo {1..399} | tr &#39; &#39; &#39;\n&#39; | shuf)&nbsp;&nbsp;&lt;(cat lista)</div>

<div>
<div>57-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>198-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>83-John Lennon - Imagine.mp3</div>

<div>272-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>278-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>106-John Lennon - Imagine.mp3</div>

<div>234-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>308-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>355-John Lennon - Imagine.mp3</div>

<div>292-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>20-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>165-John Lennon - Imagine.mp3</div>

<div>315-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>275-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>366-John Lennon - Imagine.mp3</div>

<div>280-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>16-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>8-John Lennon - Imagine.mp3</div>

<div>251-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>3-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>382-John Lennon - Imagine.mp3</div>

<div>&nbsp;</div>

<div>e por a&iacute; vai</div>
<br>
<br>
&nbsp;</div>
</div>
&nbsp; <div class="gmail_quote"> <div dir="ltr">On Tue, May 2, 2017 at 11:51 AM Dito Ramos <a href="/compose?to=***@uol.com.br" target="_blank">***@uol.com.br</a> [shell-script] &lt;<a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt; wrote:</div>

<blockquote class="gmail_quote" style="border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div style="background-color: rgb(255, 255, 255);"><span>&nbsp;</span>

<div id="m_-772472528692901369ygrp-mlmsg">
<div id="m_-772472528692901369ygrp-msg">
<div id="m_-772472528692901369ygrp-text">
<p>Boa, Itamar. Funcionou, em partes.<br>
S&oacute; que eu preciso armazenar $i para usar futuramente, entende?<br>
Na pr&aacute;tica, tenho um diret&oacute;rio com 250 arquivos .mp3. Ex:<br>
<br>
Vin&iacute;cius de Moraes - Garota de Ipanema.mp3<br>
Chico Buarque - Constru&ccedil;&atilde;o.mp3<br>
John Lennon - Imagine.mp3<br>
..... e assim por diante.<br>
<br>
Quero pegar $i do la&ccedil;o l&aacute; e renomear os arquivos pr&aacute; que fiquem assim, por exemplo:<br>
<br>
202 - Vin&iacute;cius de Moraes - Garota de Ipanema.mp3<br>
050 - hico Buarque - Constru&ccedil;&atilde;o.mp3<br>
002 - John Lennon - Imagine.mp3<br>
... e assim por diante.<br>
<br>
Por isso &eacute; importante manter o la&ccedil;o for l&aacute;, entende?<br>
<br>
Mas mesmo assim, agrade&ccedil;o.<br>
<br>
Dito</p> <hr> <div><br> <strong>De: </strong>&quot;Alfredo Casanova <a href="/compose?to=***@gmail.com" target="_blank">***@gmail.com</a> [shell-script]&quot; &lt;<a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt;<br>
<strong>Enviada: </strong>2017/05/02 11:39:12<br>
<strong>Para: </strong><a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a><br>
<strong>Assunto: </strong> Re: [shell-script] Imprimir sequ&ecirc;ncia de n&uacute;meros randomicamente, SEM REPETI&Ccedil;&Atilde;O<br>
&nbsp;</div>
<span>&nbsp;</span>

<div id="m_-772472528692901369ygrp-text">&nbsp;</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_-772472528692901369ygrp-mlmsg">
<div id="m_-772472528692901369ygrp-msg">
<div id="m_-772472528692901369ygrp-text">
<p>&nbsp;</p>

<div id="m_-772472528692901369ygrp-text">
<p>&nbsp;</p>

<div dir="ltr">Dito, vc pode fazer a primeira tarefa usando a seguinte constru&ccedil;&atilde;o:<br>
echo {0..500..2} <div>&nbsp;</div> <div>Isso vai imprimir os numeros de 0 a 500 com incremento de 2.</div> <div>&nbsp;</div> <div>Para &quot;embaralhar&quot; todos, eu faria:</div> <div>&nbsp;</div> <div>echo {0..500..2} | tr &#39; &#39; &#39;\n&#39; | shuf</div> </div> </div> <p>&nbsp;</p> </div> </div> </div> </div> <div style="background-color: rgb(255, 255, 255);"> <div id="m_-772472528692901369ygrp-mlmsg"> <div id="m_-772472528692901369ygrp-msg"> <div id="m_-772472528692901369ygrp-text"> <p>&nbsp;</p> <div id="m_-772472528692901369ygrp-text"> <div class="gmail_quote"> <div dir="ltr">On Tue, May 2, 2017 at 11:34 AM Dito Ramos <a href="http:///compose?to=***@uol.com.br" target="_blank">***@uol.com.br</a> [shell-script] &lt;<a href="http:///compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt; wrote:</div>
</div>
</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_-772472528692901369ygrp-mlmsg">
<div id="m_-772472528692901369ygrp-msg">
<div id="m_-772472528692901369ygrp-text">
<p>&nbsp;</p>

<div id="m_-772472528692901369ygrp-text">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div style="background-color: rgb(255, 255, 255);"><span>&nbsp;</span>

<div id="m_-772472528692901369m_7183178578860059162ygrp-mlmsg">
<div id="m_-772472528692901369m_7183178578860059162ygrp-msg">
<div id="m_-772472528692901369m_7183178578860059162ygrp-text">
<p>&nbsp;</p>

<p>Mestres,<br>
Eu me aposentei do servi&ccedil;o e dei uma &quot;travada&quot; aqui em shell script.<br>
Agora estou, aos poucos, voltando a dar uma mexida.<br>
Portanto, perdoem se a quest&atilde;o &eacute; muito &quot;boba&quot;<br>
Vamos l&aacute;:<br>
Preciso imprimir de 1 a 500, somente n&uacute;meros pares.<br>
At&eacute; a&iacute;, tudo bem. Fiz assim:<br>
<br>
#!/bin/bash<br>
for ((i=1;i&lt;501;i&#43;+))<br>
do<br>
&nbsp;(( $i % 2 == 0 )) &amp;&amp; echo $i<br>
done<br>
<br>
Por&eacute;m, preciso imprimir essa sequ&ecirc;ncia randomicamente, mas sem repetir nenhum n&uacute;mero, de forma que me seja retornado os 250 n&uacute;meros da cadeia.<br>
Sei que tem a vari&aacute;vel $random. Mas n&atilde;o estou sabendo usar para este caso.<br>
Podem ajudar?<br>
<br>
Grato<br>
<br>
Dito Ramos&nbsp;<br>
&nbsp;</p>

<p>&nbsp;</p>
</div>

<div style="height: 0px;color: rgb(255, 255, 255);">&nbsp;</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_-772472528692901369ygrp-mlmsg">
<div id="m_-772472528692901369ygrp-msg">
<div style="height: 0px;color: rgb(255, 255, 255);">&nbsp;</div>
</div>
</div>
</div>
</blockquote>
</div>

<p>&nbsp;</p>
</div>
<!-- end group email -->
</p>

</div>


<!--~-|**|PrettyHtmlStart|**|-~-->
<div style="color: #fff; height: 0;">__._,_.___</div>






<div style="clear:both"> </div>

<div id="fromDMARC" style="margin-top: 10px;">
<hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
Enviado por: Dito Ramos &lt;***@uol.com.br&gt; <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
</div>
<div style="clear:both"> </div>

<table cellspacing=4px style="margin-top: 10px; margin-bottom: 10px; color: #2D50FD;">
<tbody>
<tr>
<td style="font-size: 12px; font-family: arial; font-weight: bold; padding: 7px 5px 5px;" >
<a style="text-decoration: none; color: #2D50FD" href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/messages/40122;_ylc=X3oDMTJxdnZhYTBnBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTIyBHNlYwNmdHIEc2xrA3JwbHkEc3RpbWUDMTQ5MzczNzkwNQ--?act=reply&messageNum=40122">Responder através da web</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="mailto:***@uol.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD;">
</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;">
<a href="mailto:shell-***@yahoogrupos.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD">
através de email </a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/newtopic;_ylc=X3oDMTJlYjlvcGZuBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTQ5MzczNzkwNQ--" style="text-decoration: none; color: #2D50FD">Adicionar um novo tópico</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;color: #2D50FD;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/topics/40117;_ylc=X3oDMTM2czI2OWMyBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTIyBHNlYwNmdHIEc2xrA3Z0cGMEc3RpbWUDMTQ5MzczNzkwNQR0cGNJZAM0MDExNw--" style="text-decoration: none; color: #2D50FD;">Mensagens neste tópico</a>
(6)
</td>
</tr>
</tbody>
</table>



<!------- Start Nav Bar ------>
<!-- |**|begin egp html banner|**| -->
<!-- |**|end egp html banner|**| -->


<div id="ygrp-grfd" style="font-family: Verdana; font-size: 12px; padding: 15px 0;">

<!-- |**|begin egp html banner|**| -->

---------------------------------------------------------------------<BR>
Esta lista não admite a abordagem de outras liguagens de programação, como perl, C etc. Quem insistir em não seguir esta regra será moderado sem prévio aviso.<BR>
---------------------------------------------------------------------<BR>
Sair da lista: shell-script-***@yahoogrupos.com.br<BR>
---------------------------------------------------------------------<BR>
Esta lista é moderada de acordo com o previsto em <a href="http://www.listas-discussao.cjb.net">http://www.listas-discussao.cjb.net</a><BR>
---------------------------------------------------------------------<BR>
Servidor Newsgroup da lista: news.gmane.org<BR>
Grupo: gmane.org.user-groups.programming.shell.brazil<BR>
<BR>

<!-- |**|end egp html banner|**| -->

</div>




<!-- |**|begin egp html banner|**| -->
<div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

<span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; "><a href="https://br.groups.yahoo.com/neo/groups/shell-script/info;_ylc=X3oDMTJlOGlkNTU4BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ5MzczNzkwNQ--" style="text-decoration: none;">Visite seu Grupo</a></span>

<ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
</ul>
</div>


<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
<a href="https://br.groups.yahoo.com/neo;_ylc=X3oDMTJkMWQ0MjZ1BF9TAzk3NDkwNDM1BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDkzNzM3OTA1" style="float: left;"><img src="http://l.yimg.com/ru/static/images/yg/img/email/new_logo/yahoo_groups_pt-BR_141x19.png" height="19" width="141" alt="Yahoo! Grupos" style="border: 0;"/></a>
<div style="color: #747575; float: right;"> &bull; <a href="https://info.yahoo.com/privacy/br/yahoo/groups/details.html" style="text-decoration: none;">Privacidade</a> &bull; <a href="mailto:shell-script-***@yahoogrupos.com.br?subject=Sair do grupo" style="text-decoration: none;">Sair do grupo</a> &bull; <a href="https://info.yahoo.com/legal/br/yahoo/utos/terms/" style="text-decoration: none;">Termos de uso</a> </div>
</div>
<br>

<!-- |**|end egp html banner|**| -->

</div> <!-- ygrp-msg -->


<!-- Sponsor -->
<!-- |**|begin egp html banner|**| -->
<div id="ygrp-sponsor" style="width:160px; float:right; clear:none; margin:0 0 25px 0; background: #fff;">

<!-- Start Recommendations -->
<div id="ygrp-reco">
</div>
<!-- End Recommendations -->



</div> <!-- |**|end egp html banner|**| -->

<div style="clear:both; color: #FFF; font-size:1px;">.</div>
</div>

<img src="http://geo.yahoo.com/serv?s=97490437/grpId=1941312/grpspId=2137111254/msgId=40122/stime=1493737905" width="1" height="1"> <br>

<img src="http://y.analytics.yahoo.com/fpc.pl?ywarid=515FB27823A7407E&a=10001310322279&js=no&resp=img" width="1" height="1">

<div style="color: #fff; height: 0;">__,_._,___</div>
<!--~-|**|PrettyHtmlEnd|**|-~-->

</body>

<!--~-|**|PrettyHtmlStart|**|-~-->
<head>
<style type="text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}

#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}

#ygrp-mkp #ads {
margin-bottom: 10px;
}

#ygrp-mkp .ad {
padding: 0 0;
}

#ygrp-mkp .ad p {
margin: 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: 700;
font-size: 78%;
line-height: 122%;
}

#ygrp-sponsor #ygrp-lc .ad {
margin-bottom: 10px;
padding: 0 0;
}

#actions {
font-family: Verdana;
font-size: 11px;
padding: 10px 0;
}

#activity {
background-color: #e0ecee;
float: left;
font-family: Verdana;
font-size: 10px;
padding: 10px;
}

#activity span {
font-weight: 700;
}

#activity span:first-child {
text-transform: uppercase;
}

#activity span a {
color: #5085b6;
text-decoration: none;
}

#activity span span {
color: #ff7900;
}

#activity span .underline {
text-decoration: underline;
}

.attach {
clear: both;
display: table;
font-family: Arial;
font-size: 12px;
padding: 10px 0;
width: 400px;
}

.attach div a {
text-decoration: none;
}

.attach img {
border: none;
padding-right: 5px;
}

.attach label {
display: block;
margin-bottom: 5px;
}

.attach label a {
text-decoration: none;
}

blockquote {
margin: 0 0 0 4px;
}

.bold {
font-family: Arial;
font-size: 13px;
font-weight: 700;
}

.bold a {
text-decoration: none;
}

dd.last p a {
font-family: Verdana;
font-weight: 700;
}

dd.last p span {
margin-right: 10px;
font-family: Verdana;
font-weight: 700;
}

dd.last p span.yshortcuts {
margin-right: 0;
}

div.attach-table div div a {
text-decoration: none;
}

div.attach-table {
width: 400px;
}

div.file-title a, div.file-title a:active, div.file-title a:hover, div.file-title a:visited {
text-decoration: none;
}

div.photo-title a, div.photo-title a:active, div.photo-title a:hover, div.photo-title a:visited {
text-decoration: none;
}

div#ygrp-mlmsg #ygrp-msg p a span.yshortcuts {
font-family: Verdana;
font-size: 10px;
font-weight: normal;
}

.green {
color: #628c2a;
}

.MsoNormal {
margin: 0 0 0 0;
}

o {
font-size: 0;
}

#photos div {
float: left;
width: 72px;
}

#photos div div {
border: 1px solid #666666;
height: 62px;
overflow: hidden;
width: 62px;
}

#photos div label {
color: #666666;
font-size: 10px;
overflow: hidden;
text-align: center;
white-space: nowrap;
width: 64px;
}

#reco-category {
font-size: 77%;
}

#reco-desc {
font-size: 77%;
}

.replbq {
margin: 4px;
}

#ygrp-actbar div a:first-child {
/* border-right: 0px solid #000;*/
margin-right: 2px;
padding-right: 5px;
}

#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-mlmsg #logo {
padding-bottom: 10px;
}


#ygrp-msg p a {
font-family: Verdana;
}

#ygrp-msg p#attach-count span {
color: #1E66AE;
font-weight: 700;
}

#ygrp-reco #reco-head {
color: #ff7900;
font-weight: 700;
}

#ygrp-reco {
margin-bottom: 20px;
padding: 0px;
}

#ygrp-sponsor #ov li a {
font-size: 130%;
text-decoration: none;
}

#ygrp-sponsor #ov li {
font-size: 77%;
list-style-type: square;
padding: 6px 0;
}

#ygrp-sponsor #ov ul {
margin: 0;
padding: 0 0 0 8px;
}

#ygrp-text {
font-family: Georgia;
}

#ygrp-text p {
margin: 0 0 1em 0;
}

#ygrp-text tt {
font-size: 120%;
}

#ygrp-vital ul li:last-child {
border-right: none !important;
}
-->
</style>
</head>

<!--~-|**|PrettyHtmlEnd|**|-~-->
</html>
<!-- end group email -->
Alfredo Casanova atcasanova@gmail.com [shell-script]
2017-05-02 15:28:19 UTC
Permalink
Eu não recebi o email do Itamar!
Post by Dito Ramos ***@uol.com.br [shell-script]
Casanova, Leslie e Itamar.
Através de suas preciosas sugestões, já consegui chegar a uma solução para
o caso.
MUITO obrigado mais uma vez a todos.
Dito
------------------------------
*Enviada: *2017/05/02 12:05:18
*Assunto: * Re: [shell-script] Imprimir sequência de números
randomicamente, SEM REPETIÇÃO
$ wc -l lista
399 lista
paste -d- <(echo {1..399} | tr ' ' '\n' | shuf) <(cat lista)
57-Vinícius de Moraes - Garota de Ipanema.mp3
198-Chico Buarque - Construção.mp3
83-John Lennon - Imagine.mp3
272-Vinícius de Moraes - Garota de Ipanema.mp3
278-Chico Buarque - Construção.mp3
106-John Lennon - Imagine.mp3
234-Vinícius de Moraes - Garota de Ipanema.mp3
308-Chico Buarque - Construção.mp3
355-John Lennon - Imagine.mp3
292-Vinícius de Moraes - Garota de Ipanema.mp3
20-Chico Buarque - Construção.mp3
165-John Lennon - Imagine.mp3
315-Vinícius de Moraes - Garota de Ipanema.mp3
275-Chico Buarque - Construção.mp3
366-John Lennon - Imagine.mp3
280-Vinícius de Moraes - Garota de Ipanema.mp3
16-Chico Buarque - Construção.mp3
8-John Lennon - Imagine.mp3
251-Vinícius de Moraes - Garota de Ipanema.mp3
3-Chico Buarque - Construção.mp3
382-John Lennon - Imagine.mp3
e por aí vai
Post by Dito Ramos ***@uol.com.br [shell-script]
Boa, Itamar. Funcionou, em partes.
Só que eu preciso armazenar $i para usar futuramente, entende?
Vinícius de Moraes - Garota de Ipanema.mp3
Chico Buarque - Construção.mp3
John Lennon - Imagine.mp3
..... e assim por diante.
Quero pegar $i do laço lá e renomear os arquivos prá que fiquem assim,
202 - Vinícius de Moraes - Garota de Ipanema.mp3
050 - hico Buarque - Construção.mp3
002 - John Lennon - Imagine.mp3
... e assim por diante.
Por isso é importante manter o laço for lá, entende?
Mas mesmo assim, agradeço.
Dito
------------------------------
*Enviada: *2017/05/02 11:39:12
*Assunto: * Re: [shell-script] Imprimir sequência de números
randomicamente, SEM REPETIÇÃO
echo {0..500..2}
Isso vai imprimir os numeros de 0 a 500 com incremento de 2.
echo {0..500..2} | tr ' ' '\n' | shuf
Post by Dito Ramos ***@uol.com.br [shell-script]
Mestres,
Eu me aposentei do serviço e dei uma "travada" aqui em shell script.
Agora estou, aos poucos, voltando a dar uma mexida.
Portanto, perdoem se a questão é muito "boba"
Preciso imprimir de 1 a 500, somente números pares.
#!/bin/bash
for ((i=1;i<501;i++))
do
(( $i % 2 == 0 )) && echo $i
done
Porém, preciso imprimir essa sequência randomicamente, mas sem repetir
nenhum número, de forma que me seja retornado os 250 números da cadeia.
Sei que tem a variável $random. Mas não estou sabendo usar para este
caso.
Podem ajudar?
Grato
Dito Ramos
Alfredo Casanova atcasanova@gmail.com [shell-script]
2017-05-02 15:28:42 UTC
Permalink
Ah, e manda o código pra gente ver!
Post by Alfredo Casanova ***@gmail.com [shell-script]
Eu não recebi o email do Itamar!
Post by Dito Ramos ***@uol.com.br [shell-script]
Casanova, Leslie e Itamar.
Através de suas preciosas sugestões, já consegui chegar a uma solução
para o caso.
MUITO obrigado mais uma vez a todos.
Dito
------------------------------
*Enviada: *2017/05/02 12:05:18
*Assunto: * Re: [shell-script] Imprimir sequência de números
randomicamente, SEM REPETIÇÃO
$ wc -l lista
399 lista
paste -d- <(echo {1..399} | tr ' ' '\n' | shuf) <(cat lista)
57-Vinícius de Moraes - Garota de Ipanema.mp3
198-Chico Buarque - Construção.mp3
83-John Lennon - Imagine.mp3
272-Vinícius de Moraes - Garota de Ipanema.mp3
278-Chico Buarque - Construção.mp3
106-John Lennon - Imagine.mp3
234-Vinícius de Moraes - Garota de Ipanema.mp3
308-Chico Buarque - Construção.mp3
355-John Lennon - Imagine.mp3
292-Vinícius de Moraes - Garota de Ipanema.mp3
20-Chico Buarque - Construção.mp3
165-John Lennon - Imagine.mp3
315-Vinícius de Moraes - Garota de Ipanema.mp3
275-Chico Buarque - Construção.mp3
366-John Lennon - Imagine.mp3
280-Vinícius de Moraes - Garota de Ipanema.mp3
16-Chico Buarque - Construção.mp3
8-John Lennon - Imagine.mp3
251-Vinícius de Moraes - Garota de Ipanema.mp3
3-Chico Buarque - Construção.mp3
382-John Lennon - Imagine.mp3
e por aí vai
Post by Dito Ramos ***@uol.com.br [shell-script]
Boa, Itamar. Funcionou, em partes.
Só que eu preciso armazenar $i para usar futuramente, entende?
Vinícius de Moraes - Garota de Ipanema.mp3
Chico Buarque - Construção.mp3
John Lennon - Imagine.mp3
..... e assim por diante.
Quero pegar $i do laço lá e renomear os arquivos prá que fiquem assim,
202 - Vinícius de Moraes - Garota de Ipanema.mp3
050 - hico Buarque - Construção.mp3
002 - John Lennon - Imagine.mp3
... e assim por diante.
Por isso é importante manter o laço for lá, entende?
Mas mesmo assim, agradeço.
Dito
------------------------------
*Enviada: *2017/05/02 11:39:12
*Assunto: * Re: [shell-script] Imprimir sequência de números
randomicamente, SEM REPETIÇÃO
echo {0..500..2}
Isso vai imprimir os numeros de 0 a 500 com incremento de 2.
echo {0..500..2} | tr ' ' '\n' | shuf
Post by Dito Ramos ***@uol.com.br [shell-script]
Mestres,
Eu me aposentei do serviço e dei uma "travada" aqui em shell script.
Agora estou, aos poucos, voltando a dar uma mexida.
Portanto, perdoem se a questão é muito "boba"
Preciso imprimir de 1 a 500, somente números pares.
#!/bin/bash
for ((i=1;i<501;i++))
do
(( $i % 2 == 0 )) && echo $i
done
Porém, preciso imprimir essa sequência randomicamente, mas sem repetir
nenhum número, de forma que me seja retornado os 250 números da cadeia.
Sei que tem a variável $random. Mas não estou sabendo usar para este
caso.
Podem ajudar?
Grato
Dito Ramos
itamarnet@yahoo.com.br [shell-script]
2017-05-02 15:34:30 UTC
Permalink
Dito obrigado pela citação,
mas os mérito são do Casanova e Leslie apenas que ofereceram soluções.


Somente agora, com o problema já resolvido, que vejo essa "postagem" e já bem encaminhada.


Aos amigos Casanova e Leslie fica aqui minha reverência as soluções oferecidas, mas infelizmente no momento não possa testar e nem oferecer uma solução alternativa para uma comparação




[]'s
Itamar
Leslie Watter watter@gmail.com [shell-script]
2017-05-02 16:52:56 UTC
Permalink
Tá tudo em casa Itamar ;-)

Normalmente vc é quem chega primeiro com uma solução mirabolante!

Abração
Post by ***@yahoo.com.br [shell-script]
Dito obrigado pela citação,
mas os mérito são do Casanova e Leslie apenas que ofereceram soluções.
Somente agora, com o problema já resolvido, que vejo essa "postagem" e já
bem encaminhada.
Aos amigos Casanova e Leslie fica aqui minha reverência as soluções
oferecidas, mas infelizmente no momento não possa testar e nem oferecer uma
solução alternativa para uma comparação
[]'s
Itamar
--
Leslie H. Watter
celo zcelo@yahoo.com [shell-script]
2017-05-02 19:48:47 UTC
Permalink
Olá, aproveitando que eu também estou dando uma desenferrujada no shellscript, vi por acaso esse problema de shell descrito pelo Dito Ramos e resolvi tentar ajudar; segue meu POG shell:***@braquiossauro:~/code/shell$ cat random500
#!/bin/bash
for i in $(($RANDOM%500))
     do
    var=$i
    if (($(($i%2)) == 0))
        then
        echo $var
        else
        source $0
    fi
done
Espero que ajude, []z
Marcelo Scrup


On Tuesday, May 2, 2017, 1:53:21 PM GMT-3, Leslie Watter ***@gmail.com [shell-script] <shell-***@yahoogrupos.com.br> wrote: 

Tá tudo em casa Itamar ;-)
Normalmente vc é quem chega primeiro com uma solução mirabolante! 
Abração
2017-05-02 12:34 GMT-03:00 ***@yahoo.com.br [shell-script] <shell-***@yahoogrupos.com.br>:

 
Dito obrigado pela citação,

mas os mérito são do Casanova e Leslie apenas que ofereceram soluções.
Somente agora, com o problema já resolvido, que vejo essa "postagem" e já bem encaminhada.
Aos amigos Casanova e Leslie fica aqui minha reverência as soluções oferecidas, mas infelizmente no momento não possa testar e nem oferecer uma solução alternativa para uma comparação

[]'sItamar
--
Leslie H. Watter #yiv5045624622 #yiv5045624622 -- #yiv5045624622ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv5045624622 #yiv5045624622ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv5045624622 #yiv5045624622ygrp-mkp #yiv5045624622hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv5045624622 #yiv5045624622ygrp-mkp #yiv5045624622ads {margin-bottom:10px;}#yiv5045624622 #yiv5045624622ygrp-mkp .yiv5045624622ad {padding:0 0;}#yiv5045624622 #yiv5045624622ygrp-mkp .yiv5045624622ad p {margin:0;}#yiv5045624622 #yiv5045624622ygrp-mkp .yiv5045624622ad a {color:#0000ff;text-decoration:none;}#yiv5045624622 #yiv5045624622ygrp-sponsor #yiv5045624622ygrp-lc {font-family:Arial;}#yiv5045624622 #yiv5045624622ygrp-sponsor #yiv5045624622ygrp-lc #yiv5045624622hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv5045624622 #yiv5045624622ygrp-sponsor #yiv5045624622ygrp-lc .yiv5045624622ad {margin-bottom:10px;padding:0 0;}#yiv5045624622 #yiv5045624622actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv5045624622 #yiv5045624622activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv5045624622 #yiv5045624622activity span {font-weight:700;}#yiv5045624622 #yiv5045624622activity span:first-child {text-transform:uppercase;}#yiv5045624622 #yiv5045624622activity span a {color:#5085b6;text-decoration:none;}#yiv5045624622 #yiv5045624622activity span span {color:#ff7900;}#yiv5045624622 #yiv5045624622activity span .yiv5045624622underline {text-decoration:underline;}#yiv5045624622 .yiv5045624622attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv5045624622 .yiv5045624622attach div a {text-decoration:none;}#yiv5045624622 .yiv5045624622attach img {border:none;padding-right:5px;}#yiv5045624622 .yiv5045624622attach label {display:block;margin-bottom:5px;}#yiv5045624622 .yiv5045624622attach label a {text-decoration:none;}#yiv5045624622 blockquote {margin:0 0 0 4px;}#yiv5045624622 .yiv5045624622bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv5045624622 .yiv5045624622bold a {text-decoration:none;}#yiv5045624622 dd.yiv5045624622last p a {font-family:Verdana;font-weight:700;}#yiv5045624622 dd.yiv5045624622last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv5045624622 dd.yiv5045624622last p span.yiv5045624622yshortcuts {margin-right:0;}#yiv5045624622 div.yiv5045624622attach-table div div a {text-decoration:none;}#yiv5045624622 div.yiv5045624622attach-table {width:400px;}#yiv5045624622 div.yiv5045624622file-title a, #yiv5045624622 div.yiv5045624622file-title a:active, #yiv5045624622 div.yiv5045624622file-title a:hover, #yiv5045624622 div.yiv5045624622file-title a:visited {text-decoration:none;}#yiv5045624622 div.yiv5045624622photo-title a, #yiv5045624622 div.yiv5045624622photo-title a:active, #yiv5045624622 div.yiv5045624622photo-title a:hover, #yiv5045624622 div.yiv5045624622photo-title a:visited {text-decoration:none;}#yiv5045624622 div#yiv5045624622ygrp-mlmsg #yiv5045624622ygrp-msg p a span.yiv5045624622yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv5045624622 .yiv5045624622green {color:#628c2a;}#yiv5045624622 .yiv5045624622MsoNormal {margin:0 0 0 0;}#yiv5045624622 o {font-size:0;}#yiv5045624622 #yiv5045624622photos div {float:left;width:72px;}#yiv5045624622 #yiv5045624622photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv5045624622 #yiv5045624622photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv5045624622 #yiv5045624622reco-category {font-size:77%;}#yiv5045624622 #yiv5045624622reco-desc {font-size:77%;}#yiv5045624622 .yiv5045624622replbq {margin:4px;}#yiv5045624622 #yiv5045624622ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv5045624622 #yiv5045624622ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv5045624622 #yiv5045624622ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv5045624622 #yiv5045624622ygrp-mlmsg select, #yiv5045624622 input, #yiv5045624622 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv5045624622 #yiv5045624622ygrp-mlmsg pre, #yiv5045624622 code {font:115% monospace;}#yiv5045624622 #yiv5045624622ygrp-mlmsg * {line-height:1.22em;}#yiv5045624622 #yiv5045624622ygrp-mlmsg #yiv5045624622logo {padding-bottom:10px;}#yiv5045624622 #yiv5045624622ygrp-msg p a {font-family:Verdana;}#yiv5045624622 #yiv5045624622ygrp-msg p#yiv5045624622attach-count span {color:#1E66AE;font-weight:700;}#yiv5045624622 #yiv5045624622ygrp-reco #yiv5045624622reco-head {color:#ff7900;font-weight:700;}#yiv5045624622 #yiv5045624622ygrp-reco {margin-bottom:20px;padding:0px;}#yiv5045624622 #yiv5045624622ygrp-sponsor #yiv5045624622ov li a {font-size:130%;text-decoration:none;}#yiv5045624622 #yiv5045624622ygrp-sponsor #yiv5045624622ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv5045624622 #yiv5045624622ygrp-sponsor #yiv5045624622ov ul {margin:0;padding:0 0 0 8px;}#yiv5045624622 #yiv5045624622ygrp-text {font-family:Georgia;}#yiv5045624622 #yiv5045624622ygrp-text p {margin:0 0 1em 0;}#yiv5045624622 #yiv5045624622ygrp-text tt {font-size:120%;}#yiv5045624622 #yiv5045624622ygrp-vital ul li:last-child {border-right:none !important;}#yiv5045624622
celo zcelo@yahoo.com [shell-script]
2017-05-02 21:51:49 UTC
Permalink
Agora vai rand500 --no-repeat


#!/bin/bash
range=(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 até 500)
for i in ${range[@]}
        do
        var=$(($RANDOM%500))
                if [ $((${range[$var]}%2)) == 0 ]
                        then
                        echo "${range[$var]}"
                fi
done
espero que ajude
Marcelo Scrup
On Tuesday, May 2, 2017, 4:48:49 PM GMT-3, celo ***@yahoo.com [shell-script] <shell-***@yahoogrupos.com.br> wrote: 


Olá, aproveitando que eu também estou dando uma desenferrujada no shellscript, vi por acaso esse problema de shell descrito pelo Dito Ramos e resolvi tentar ajudar; segue meu POG shell:***@braquiossauro:~/code/shell$ cat random500
#!/bin/bash
for i in $(($RANDOM%500))
     do
    var=$i
    if (($(($i%2)) == 0))
        then
        echo $var
        else
        source $0
    fi
done
Espero que ajude, []z
Marcelo Scrup


On Tuesday, May 2, 2017, 1:53:21 PM GMT-3, Leslie Watter ***@gmail.com [shell-script] <shell-***@yahoogrupos.com.br> wrote: 

Tá tudo em casa Itamar ;-)
Normalmente vc é quem chega primeiro com uma solução mirabolante! 
Abração
2017-05-02 12:34 GMT-03:00 ***@yahoo.com.br [shell-script] <shell-***@yahoogrupos.com.br>:

 
Dito obrigado pela citação,

mas os mérito são do Casanova e Leslie apenas que ofereceram soluções.
Somente agora, com o problema já resolvido, que vejo essa "postagem" e já bem encaminhada.
Aos amigos Casanova e Leslie fica aqui minha reverência as soluções oferecidas, mas infelizmente no momento não possa testar e nem oferecer uma solução alternativa para uma comparação

[]'sItamar
--
Leslie H. Watter #yiv1780848253 #yiv1780848253 -- #yiv1780848253ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv1780848253 #yiv1780848253ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv1780848253 #yiv1780848253ygrp-mkp #yiv1780848253hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv1780848253 #yiv1780848253ygrp-mkp #yiv1780848253ads {margin-bottom:10px;}#yiv1780848253 #yiv1780848253ygrp-mkp .yiv1780848253ad {padding:0 0;}#yiv1780848253 #yiv1780848253ygrp-mkp .yiv1780848253ad p {margin:0;}#yiv1780848253 #yiv1780848253ygrp-mkp .yiv1780848253ad a {color:#0000ff;text-decoration:none;}#yiv1780848253 #yiv1780848253ygrp-sponsor #yiv1780848253ygrp-lc {font-family:Arial;}#yiv1780848253 #yiv1780848253ygrp-sponsor #yiv1780848253ygrp-lc #yiv1780848253hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv1780848253 #yiv1780848253ygrp-sponsor #yiv1780848253ygrp-lc .yiv1780848253ad {margin-bottom:10px;padding:0 0;}#yiv1780848253 #yiv1780848253actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv1780848253 #yiv1780848253activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv1780848253 #yiv1780848253activity span {font-weight:700;}#yiv1780848253 #yiv1780848253activity span:first-child {text-transform:uppercase;}#yiv1780848253 #yiv1780848253activity span a {color:#5085b6;text-decoration:none;}#yiv1780848253 #yiv1780848253activity span span {color:#ff7900;}#yiv1780848253 #yiv1780848253activity span .yiv1780848253underline {text-decoration:underline;}#yiv1780848253 .yiv1780848253attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv1780848253 .yiv1780848253attach div a {text-decoration:none;}#yiv1780848253 .yiv1780848253attach img {border:none;padding-right:5px;}#yiv1780848253 .yiv1780848253attach label {display:block;margin-bottom:5px;}#yiv1780848253 .yiv1780848253attach label a {text-decoration:none;}#yiv1780848253 blockquote {margin:0 0 0 4px;}#yiv1780848253 .yiv1780848253bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv1780848253 .yiv1780848253bold a {text-decoration:none;}#yiv1780848253 dd.yiv1780848253last p a {font-family:Verdana;font-weight:700;}#yiv1780848253 dd.yiv1780848253last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv1780848253 dd.yiv1780848253last p span.yiv1780848253yshortcuts {margin-right:0;}#yiv1780848253 div.yiv1780848253attach-table div div a {text-decoration:none;}#yiv1780848253 div.yiv1780848253attach-table {width:400px;}#yiv1780848253 div.yiv1780848253file-title a, #yiv1780848253 div.yiv1780848253file-title a:active, #yiv1780848253 div.yiv1780848253file-title a:hover, #yiv1780848253 div.yiv1780848253file-title a:visited {text-decoration:none;}#yiv1780848253 div.yiv1780848253photo-title a, #yiv1780848253 div.yiv1780848253photo-title a:active, #yiv1780848253 div.yiv1780848253photo-title a:hover, #yiv1780848253 div.yiv1780848253photo-title a:visited {text-decoration:none;}#yiv1780848253 div#yiv1780848253ygrp-mlmsg #yiv1780848253ygrp-msg p a span.yiv1780848253yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv1780848253 .yiv1780848253green {color:#628c2a;}#yiv1780848253 .yiv1780848253MsoNormal {margin:0 0 0 0;}#yiv1780848253 o {font-size:0;}#yiv1780848253 #yiv1780848253photos div {float:left;width:72px;}#yiv1780848253 #yiv1780848253photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv1780848253 #yiv1780848253photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv1780848253 #yiv1780848253reco-category {font-size:77%;}#yiv1780848253 #yiv1780848253reco-desc {font-size:77%;}#yiv1780848253 .yiv1780848253replbq {margin:4px;}#yiv1780848253 #yiv1780848253ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv1780848253 #yiv1780848253ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv1780848253 #yiv1780848253ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv1780848253 #yiv1780848253ygrp-mlmsg select, #yiv1780848253 input, #yiv1780848253 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv1780848253 #yiv1780848253ygrp-mlmsg pre, #yiv1780848253 code {font:115% monospace;}#yiv1780848253 #yiv1780848253ygrp-mlmsg * {line-height:1.22em;}#yiv1780848253 #yiv1780848253ygrp-mlmsg #yiv1780848253logo {padding-bottom:10px;}#yiv1780848253 #yiv1780848253ygrp-msg p a {font-family:Verdana;}#yiv1780848253 #yiv1780848253ygrp-msg p#yiv1780848253attach-count span {color:#1E66AE;font-weight:700;}#yiv1780848253 #yiv1780848253ygrp-reco #yiv1780848253reco-head {color:#ff7900;font-weight:700;}#yiv1780848253 #yiv1780848253ygrp-reco {margin-bottom:20px;padding:0px;}#yiv1780848253 #yiv1780848253ygrp-sponsor #yiv1780848253ov li a {font-size:130%;text-decoration:none;}#yiv1780848253 #yiv1780848253ygrp-sponsor #yiv1780848253ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv1780848253 #yiv1780848253ygrp-sponsor #yiv1780848253ov ul {margin:0;padding:0 0 0 8px;}#yiv1780848253 #yiv1780848253ygrp-text {font-family:Georgia;}#yiv1780848253 #yiv1780848253ygrp-text p {margin:0 0 1em 0;}#yiv1780848253 #yiv1780848253ygrp-text tt {font-size:120%;}#yiv1780848253 #yiv1780848253ygrp-vital ul li:last-child {border-right:none !important;}#yiv1780848253
celo zcelo@yahoo.com [shell-script]
2017-05-02 21:59:33 UTC
Permalink
Agora vai:***@braquiossauro:~/code/shell$ cat rand500
#!/bin/bash
range=($(echo {0..500}))
for i in ${range[@]}
    do
    var=$(($RANDOM%500))
        if [ $((${range[$var]}%2)) == 0 ]
            then
            echo "${range[$var]}"
        fi
done
Boa sorte
Marcelo Scrup


On Tuesday, May 2, 2017, 6:51:53 PM GMT-3, celo ***@yahoo.com [shell-script] <shell-***@yahoogrupos.com.br> wrote: 

Agora vai rand500 --no-repeat


#!/bin/bash
range=(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 até 500)
for i in ${range[@]}
        do
        var=$(($RANDOM%500))
                if [ $((${range[$var]}%2)) == 0 ]
                        then
                        echo "${range[$var]}"
                fi
done
espero que ajude
Marcelo Scrup
On Tuesday, May 2, 2017, 4:48:49 PM GMT-3, celo ***@yahoo.com [shell-script] <shell-***@yahoogrupos.com.br> wrote: 


Olá, aproveitando que eu também estou dando uma desenferrujada no shellscript, vi por acaso esse problema de shell descrito pelo Dito Ramos e resolvi tentar ajudar; segue meu POG shell:***@braquiossauro:~/code/shell$ cat random500
#!/bin/bash
for i in $(($RANDOM%500))
     do
    var=$i
    if (($(($i%2)) == 0))
        then
        echo $var
        else
        source $0
    fi
done
Espero que ajude, []z
Marcelo Scrup


On Tuesday, May 2, 2017, 1:53:21 PM GMT-3, Leslie Watter ***@gmail.com [shell-script] <shell-***@yahoogrupos.com.br> wrote: 

Tá tudo em casa Itamar ;-)
Normalmente vc é quem chega primeiro com uma solução mirabolante! 
Abração
2017-05-02 12:34 GMT-03:00 ***@yahoo.com.br [shell-script] <shell-***@yahoogrupos.com.br>:

 
Dito obrigado pela citação,

mas os mérito são do Casanova e Leslie apenas que ofereceram soluções.
Somente agora, com o problema já resolvido, que vejo essa "postagem" e já bem encaminhada.
Aos amigos Casanova e Leslie fica aqui minha reverência as soluções oferecidas, mas infelizmente no momento não possa testar e nem oferecer uma solução alternativa para uma comparação

[]'sItamar
--
Leslie H. Watter #yiv4440531774 #yiv4440531774 -- #yiv4440531774ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv4440531774 #yiv4440531774ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv4440531774 #yiv4440531774ygrp-mkp #yiv4440531774hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv4440531774 #yiv4440531774ygrp-mkp #yiv4440531774ads {margin-bottom:10px;}#yiv4440531774 #yiv4440531774ygrp-mkp .yiv4440531774ad {padding:0 0;}#yiv4440531774 #yiv4440531774ygrp-mkp .yiv4440531774ad p {margin:0;}#yiv4440531774 #yiv4440531774ygrp-mkp .yiv4440531774ad a {color:#0000ff;text-decoration:none;}#yiv4440531774 #yiv4440531774ygrp-sponsor #yiv4440531774ygrp-lc {font-family:Arial;}#yiv4440531774 #yiv4440531774ygrp-sponsor #yiv4440531774ygrp-lc #yiv4440531774hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv4440531774 #yiv4440531774ygrp-sponsor #yiv4440531774ygrp-lc .yiv4440531774ad {margin-bottom:10px;padding:0 0;}#yiv4440531774 #yiv4440531774actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv4440531774 #yiv4440531774activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv4440531774 #yiv4440531774activity span {font-weight:700;}#yiv4440531774 #yiv4440531774activity span:first-child {text-transform:uppercase;}#yiv4440531774 #yiv4440531774activity span a {color:#5085b6;text-decoration:none;}#yiv4440531774 #yiv4440531774activity span span {color:#ff7900;}#yiv4440531774 #yiv4440531774activity span .yiv4440531774underline {text-decoration:underline;}#yiv4440531774 .yiv4440531774attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv4440531774 .yiv4440531774attach div a {text-decoration:none;}#yiv4440531774 .yiv4440531774attach img {border:none;padding-right:5px;}#yiv4440531774 .yiv4440531774attach label {display:block;margin-bottom:5px;}#yiv4440531774 .yiv4440531774attach label a {text-decoration:none;}#yiv4440531774 blockquote {margin:0 0 0 4px;}#yiv4440531774 .yiv4440531774bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv4440531774 .yiv4440531774bold a {text-decoration:none;}#yiv4440531774 dd.yiv4440531774last p a {font-family:Verdana;font-weight:700;}#yiv4440531774 dd.yiv4440531774last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv4440531774 dd.yiv4440531774last p span.yiv4440531774yshortcuts {margin-right:0;}#yiv4440531774 div.yiv4440531774attach-table div div a {text-decoration:none;}#yiv4440531774 div.yiv4440531774attach-table {width:400px;}#yiv4440531774 div.yiv4440531774file-title a, #yiv4440531774 div.yiv4440531774file-title a:active, #yiv4440531774 div.yiv4440531774file-title a:hover, #yiv4440531774 div.yiv4440531774file-title a:visited {text-decoration:none;}#yiv4440531774 div.yiv4440531774photo-title a, #yiv4440531774 div.yiv4440531774photo-title a:active, #yiv4440531774 div.yiv4440531774photo-title a:hover, #yiv4440531774 div.yiv4440531774photo-title a:visited {text-decoration:none;}#yiv4440531774 div#yiv4440531774ygrp-mlmsg #yiv4440531774ygrp-msg p a span.yiv4440531774yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv4440531774 .yiv4440531774green {color:#628c2a;}#yiv4440531774 .yiv4440531774MsoNormal {margin:0 0 0 0;}#yiv4440531774 o {font-size:0;}#yiv4440531774 #yiv4440531774photos div {float:left;width:72px;}#yiv4440531774 #yiv4440531774photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv4440531774 #yiv4440531774photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv4440531774 #yiv4440531774reco-category {font-size:77%;}#yiv4440531774 #yiv4440531774reco-desc {font-size:77%;}#yiv4440531774 .yiv4440531774replbq {margin:4px;}#yiv4440531774 #yiv4440531774ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv4440531774 #yiv4440531774ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv4440531774 #yiv4440531774ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv4440531774 #yiv4440531774ygrp-mlmsg select, #yiv4440531774 input, #yiv4440531774 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv4440531774 #yiv4440531774ygrp-mlmsg pre, #yiv4440531774 code {font:115% monospace;}#yiv4440531774 #yiv4440531774ygrp-mlmsg * {line-height:1.22em;}#yiv4440531774 #yiv4440531774ygrp-mlmsg #yiv4440531774logo {padding-bottom:10px;}#yiv4440531774 #yiv4440531774ygrp-msg p a {font-family:Verdana;}#yiv4440531774 #yiv4440531774ygrp-msg p#yiv4440531774attach-count span {color:#1E66AE;font-weight:700;}#yiv4440531774 #yiv4440531774ygrp-reco #yiv4440531774reco-head {color:#ff7900;font-weight:700;}#yiv4440531774 #yiv4440531774ygrp-reco {margin-bottom:20px;padding:0px;}#yiv4440531774 #yiv4440531774ygrp-sponsor #yiv4440531774ov li a {font-size:130%;text-decoration:none;}#yiv4440531774 #yiv4440531774ygrp-sponsor #yiv4440531774ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv4440531774 #yiv4440531774ygrp-sponsor #yiv4440531774ov ul {margin:0;padding:0 0 0 8px;}#yiv4440531774 #yiv4440531774ygrp-text {font-family:Georgia;}#yiv4440531774 #yiv4440531774ygrp-text p {margin:0 0 1em 0;}#yiv4440531774 #yiv4440531774ygrp-text tt {font-size:120%;}#yiv4440531774 #yiv4440531774ygrp-vital ul li:last-child {border-right:none !important;}#yiv4440531774
Dito Ramos diramos@uol.com.br [shell-script]
2017-05-02 22:47:30 UTC
Permalink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>







<body style="background-color: #fff;">
<span style="display:none">&nbsp;</span>

<!--~-|**|PrettyHtmlStartT|**|-~-->
<div id="ygrp-mlmsg" style="position:relative;">
<div id="ygrp-msg" style="z-index: 1;">
<!--~-|**|PrettyHtmlEndT|**|-~-->

<div id="ygrp-text" >


<p>&nbsp;
<p>&nbsp;</p>
&nbsp; <hr> <div><br> <strong>De: </strong>&quot;Dito Ramos&quot; &lt;***@uol.com.br&gt;<br>
<strong>Enviada: </strong>2017/05/02 18:17:25<br>
<strong>Para: </strong>shell-***@yahoogrupos.com.br, shell-***@yahoogrupos.com.br<br>
<strong>Assunto: </strong> RE: [shell-script] Imprimir sequ&ecirc;ncia de n&uacute;meros randomicamente, SEM REPETI&Ccedil;&Atilde;O<br>
&nbsp;</div>
Celo, obrigado.<br>
Seu retorno ser&aacute; muito &uacute;til para eu &quot;desenferrujar&quot; meus conhecimentos em shell aqui.<br>
<br>
Pessoal, olhem s&oacute;:<br>
Seguindo a&nbsp;sua linha de racioc&iacute;nio, fiz o seguinte:<br>
<br>
#!/bin/bash<br>
IFS=&#39;&#39;<br>
for arquivo_novo in `paste -d &quot;-&quot; &lt;(seq -f &quot;%03g&quot; 2 2 984 | tr &#39; &#39; &#39;\n&#39; | shuf)&nbsp; &lt;(ls meu_diretorio)`<br>
do<br>
&nbsp;&nbsp;&nbsp;&nbsp;arquivo_original=$(echo $arquivo_novo | awk -F- &#39;{$1=&quot;&quot;;print $0}&#39;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;echo $arquivo_original<br>
&nbsp;&nbsp;&nbsp;&nbsp;echo $arquivo_novo<br>
done<br>
<br>
O que eu preciso &eacute; que a sa&iacute;da seja assim, por exemplo:<br>
<br>
Chico Buarque - Constru&ccedil;&atilde;o<br>
402-Chico Buarque - Constru&ccedil;&atilde;o<br>
Vinicius de Moraes - Garota de Ipanema<br>
204-Vinicius de Moraes - Garota de Ipanema<br>
....e assim por diante.<br>
<br>
Porque futuramente vou dar um $ mv &nbsp;$arquivo original $arquivo novo, entendem?<br>
<br>
Mas o que t&aacute; acontecendo &eacute; que o script est&aacute; mostrando toda listagem dos arquivos com nomes originais e, ao t&eacute;rmino, lista os arquivos com a numera&ccedil;&atilde;o no in&iacute;cio.<br>
E a&iacute; n&atilde;o d&aacute; pr&aacute; eu fazer o que preciso.<br>
Podem ajudar, me dizendo onde estou errando?<br>
Grato mais uma vez.<br>
<br>
Dito Ramos <hr> <div><br> <strong>De: </strong>&quot;celo ***@yahoo.com [shell-script]&quot; &lt;shell-***@yahoogrupos.com.br&gt;<br>
<strong>Enviada: </strong>2017/05/02 16:48:52<br>
<strong>Para: </strong>shell-***@yahoogrupos.com.br<br>
<strong>Assunto: </strong> Re: [shell-script] Imprimir sequ&ecirc;ncia de n&uacute;meros randomicamente, SEM REPETI&Ccedil;&Atilde;O<br>
&nbsp;</div>
<span>&nbsp;</span>
<div id="ygrp-text">
<p>&nbsp;</p>

<div style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif;font-size: small;">
<div>
<div>&nbsp;</div>
</div>

<div>
<div>Ol&aacute;, aproveitando que eu tamb&eacute;m estou dando uma desenferrujada no shellscript, vi por acaso esse problema de shell descrito pelo Dito Ramos e resolvi tentar ajudar; segue meu POG shell:</div>

<div>***@braquiossauro:~/code/shell$ cat random500<br>
#!/bin/bash<br>
for i in $(($RANDOM%500))<br>
&nbsp;&nbsp;&nbsp;&nbsp; do<br>
&nbsp;&nbsp;&nbsp;&nbsp;var=$i<br>
&nbsp;&nbsp;&nbsp;&nbsp;if (($(($i%2)) == 0))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $var<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;source $0<br>
&nbsp;&nbsp;&nbsp;&nbsp;fi
<div>done</div>

<div>&nbsp;</div>

<div>Espero que ajude, []z<br>
Marcelo Scrup</div>
</div>
<br>
&nbsp;</div> <div class="yahoo_quoted" id="yahoo_quoted_3816885573"> <div>On Tuesday, May 2, 2017, 1:53:21 PM GMT-3, Leslie Watter ***@gmail.com [shell-script] &lt;shell-***@yahoogrupos.com.br&gt; wrote:</div> <div> <div id="yiv5045624622"> <div><span>&nbsp;</span> <div id="yiv5045624622ygrp-mlmsg"> <div id="yiv5045624622ygrp-msg"> <div id="yiv5045624622ygrp-text"> <p>&nbsp;</p> <div dir="ltr">T&aacute; tudo em casa Itamar ;-) <div>&nbsp;</div> <div>Normalmente vc &eacute; quem chega primeiro com uma solu&ccedil;&atilde;o mirabolante!&nbsp;</div> <div>&nbsp;</div> <div>Abra&ccedil;&atilde;o</div> </div> <div class="yiv5045624622gmail_extra">&nbsp; <div class="yiv5045624622gmail_quote">2017-05-02 12:34 GMT-03:00 <a href="/compose?to=***@yahoo.com.br" rel="nofollow" shape="rect" target="_blank" ymailto="mailto:***@yahoo.com.br">***@yahoo.com.br</a> [shell-script] <span dir="ltr">&lt;<a href="/compose?to=shell-***@yahoogrupos.com.br" rel="nofollow" shape="rect" target="_blank" ymailto="mailto:shell-***@yahoogrupos.com.br">shell-***@yahoogrupos.com.br</a>&gt;</span>:

<div class="yiv5045624622yqt8145232467" id="yiv5045624622yqt81680">
<blockquote class="yiv5045624622gmail_quote" style="border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div style="background-color: rgb(255, 255, 255);"><span>&nbsp;</span>

<div id="yiv5045624622m_2903122412957704216ygrp-mlmsg">
<div id="yiv5045624622m_2903122412957704216ygrp-msg">
<div id="yiv5045624622m_2903122412957704216ygrp-text">
<p>Dito obrigado pela cita&ccedil;&atilde;o,</p>

<div>&nbsp;
<div>mas os m&eacute;rito s&atilde;o do Casanova e Leslie apenas que ofereceram solu&ccedil;&otilde;es.</div>

<div>&nbsp;</div>

<div>Somente agora, com o problema j&aacute; resolvido, que vejo essa &quot;postagem&quot; e j&aacute; bem encaminhada.</div>

<div>&nbsp;</div>

<div>Aos amigos Casanova e Leslie fica aqui minha rever&ecirc;ncia as solu&ccedil;&otilde;es oferecidas, mas infelizmente no momento n&atilde;o possa testar e nem oferecer uma solu&ccedil;&atilde;o alternativa para uma compara&ccedil;&atilde;o</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>[]&#39;s</div>

<div>Itamar</div>
</div>

<p>&nbsp;</p>
</div>

<div style="height: 0px;color: rgb(255, 255, 255);">&nbsp;</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
&nbsp;

<div>&nbsp;</div>
--

<div class="yiv5045624622gmail_signature">Leslie H. Watter</div>
</div>
</div>

<div class="yiv5045624622yqt8145232467" id="yiv5045624622yqt00791">
<div style="height: 0px;color: rgb(255, 255, 255);">&nbsp;</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<p>&nbsp;</p>
</div>
<!-- end group email -->
</p>

</div>


<!--~-|**|PrettyHtmlStart|**|-~-->
<div style="color: #fff; height: 0;">__._,_.___</div>






<div style="clear:both"> </div>

<div id="fromDMARC" style="margin-top: 10px;">
<hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
Enviado por: Dito Ramos &lt;***@uol.com.br&gt; <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
</div>
<div style="clear:both"> </div>

<table cellspacing=4px style="margin-top: 10px; margin-bottom: 10px; color: #2D50FD;">
<tbody>
<tr>
<td style="font-size: 12px; font-family: arial; font-weight: bold; padding: 7px 5px 5px;" >
<a style="text-decoration: none; color: #2D50FD" href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/messages/40132;_ylc=X3oDMTJxMHVzOGJrBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTMyBHNlYwNmdHIEc2xrA3JwbHkEc3RpbWUDMTQ5Mzc2NTI1Ng--?act=reply&messageNum=40132">Responder através da web</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="mailto:***@uol.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD;">
</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;">
<a href="mailto:shell-***@yahoogrupos.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD">
através de email </a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/newtopic;_ylc=X3oDMTJlNjRxaTk4BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTQ5Mzc2NTI1Ng--" style="text-decoration: none; color: #2D50FD">Adicionar um novo tópico</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;color: #2D50FD;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/topics/40117;_ylc=X3oDMTM2ZXUxZWF2BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTMyBHNlYwNmdHIEc2xrA3Z0cGMEc3RpbWUDMTQ5Mzc2NTI1NgR0cGNJZAM0MDExNw--" style="text-decoration: none; color: #2D50FD;">Mensagens neste tópico</a>
(15)
</td>
</tr>
</tbody>
</table>



<!------- Start Nav Bar ------>
<!-- |**|begin egp html banner|**| -->
<!-- |**|end egp html banner|**| -->


<div id="ygrp-grfd" style="font-family: Verdana; font-size: 12px; padding: 15px 0;">

<!-- |**|begin egp html banner|**| -->

---------------------------------------------------------------------<BR>
Esta lista não admite a abordagem de outras liguagens de programação, como perl, C etc. Quem insistir em não seguir esta regra será moderado sem prévio aviso.<BR>
---------------------------------------------------------------------<BR>
Sair da lista: shell-script-***@yahoogrupos.com.br<BR>
---------------------------------------------------------------------<BR>
Esta lista é moderada de acordo com o previsto em <a href="http://www.listas-discussao.cjb.net">http://www.listas-discussao.cjb.net</a><BR>
---------------------------------------------------------------------<BR>
Servidor Newsgroup da lista: news.gmane.org<BR>
Grupo: gmane.org.user-groups.programming.shell.brazil<BR>
<BR>

<!-- |**|end egp html banner|**| -->

</div>




<!-- |**|begin egp html banner|**| -->
<div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

<span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; "><a href="https://br.groups.yahoo.com/neo/groups/shell-script/info;_ylc=X3oDMTJla3NuaGVpBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ5Mzc2NTI1Ng--" style="text-decoration: none;">Visite seu Grupo</a></span>

<ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
</ul>
</div>


<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
<a href="https://br.groups.yahoo.com/neo;_ylc=X3oDMTJkZmE4MDZmBF9TAzk3NDkwNDM1BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDkzNzY1MjU2" style="float: left;"><img src="http://l.yimg.com/ru/static/images/yg/img/email/new_logo/yahoo_groups_pt-BR_141x19.png" height="19" width="141" alt="Yahoo! Grupos" style="border: 0;"/></a>
<div style="color: #747575; float: right;"> &bull; <a href="https://info.yahoo.com/privacy/br/yahoo/groups/details.html" style="text-decoration: none;">Privacidade</a> &bull; <a href="mailto:shell-script-***@yahoogrupos.com.br?subject=Sair do grupo" style="text-decoration: none;">Sair do grupo</a> &bull; <a href="https://info.yahoo.com/legal/br/yahoo/utos/terms/" style="text-decoration: none;">Termos de uso</a> </div>
</div>
<br>

<!-- |**|end egp html banner|**| -->

</div> <!-- ygrp-msg -->


<!-- Sponsor -->
<!-- |**|begin egp html banner|**| -->
<div id="ygrp-sponsor" style="width:160px; float:right; clear:none; margin:0 0 25px 0; background: #fff;">

<!-- Start Recommendations -->
<div id="ygrp-reco">
</div>
<!-- End Recommendations -->



</div> <!-- |**|end egp html banner|**| -->

<div style="clear:both; color: #FFF; font-size:1px;">.</div>
</div>

<img src="http://geo.yahoo.com/serv?s=97490437/grpId=1941312/grpspId=2137111254/msgId=40132/stime=1493765256" width="1" height="1"> <br>

<img src="http://y.analytics.yahoo.com/fpc.pl?ywarid=515FB27823A7407E&a=10001310322279&js=no&resp=img" width="1" height="1">

<div style="color: #fff; height: 0;">__,_._,___</div>
<!--~-|**|PrettyHtmlEnd|**|-~-->

</body>

<!--~-|**|PrettyHtmlStart|**|-~-->
<head>
<style type="text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}

#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}

#ygrp-mkp #ads {
margin-bottom: 10px;
}

#ygrp-mkp .ad {
padding: 0 0;
}

#ygrp-mkp .ad p {
margin: 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: 700;
font-size: 78%;
line-height: 122%;
}

#ygrp-sponsor #ygrp-lc .ad {
margin-bottom: 10px;
padding: 0 0;
}

#actions {
font-family: Verdana;
font-size: 11px;
padding: 10px 0;
}

#activity {
background-color: #e0ecee;
float: left;
font-family: Verdana;
font-size: 10px;
padding: 10px;
}

#activity span {
font-weight: 700;
}

#activity span:first-child {
text-transform: uppercase;
}

#activity span a {
color: #5085b6;
text-decoration: none;
}

#activity span span {
color: #ff7900;
}

#activity span .underline {
text-decoration: underline;
}

.attach {
clear: both;
display: table;
font-family: Arial;
font-size: 12px;
padding: 10px 0;
width: 400px;
}

.attach div a {
text-decoration: none;
}

.attach img {
border: none;
padding-right: 5px;
}

.attach label {
display: block;
margin-bottom: 5px;
}

.attach label a {
text-decoration: none;
}

blockquote {
margin: 0 0 0 4px;
}

.bold {
font-family: Arial;
font-size: 13px;
font-weight: 700;
}

.bold a {
text-decoration: none;
}

dd.last p a {
font-family: Verdana;
font-weight: 700;
}

dd.last p span {
margin-right: 10px;
font-family: Verdana;
font-weight: 700;
}

dd.last p span.yshortcuts {
margin-right: 0;
}

div.attach-table div div a {
text-decoration: none;
}

div.attach-table {
width: 400px;
}

div.file-title a, div.file-title a:active, div.file-title a:hover, div.file-title a:visited {
text-decoration: none;
}

div.photo-title a, div.photo-title a:active, div.photo-title a:hover, div.photo-title a:visited {
text-decoration: none;
}

div#ygrp-mlmsg #ygrp-msg p a span.yshortcuts {
font-family: Verdana;
font-size: 10px;
font-weight: normal;
}

.green {
color: #628c2a;
}

.MsoNormal {
margin: 0 0 0 0;
}

o {
font-size: 0;
}

#photos div {
float: left;
width: 72px;
}

#photos div div {
border: 1px solid #666666;
height: 62px;
overflow: hidden;
width: 62px;
}

#photos div label {
color: #666666;
font-size: 10px;
overflow: hidden;
text-align: center;
white-space: nowrap;
width: 64px;
}

#reco-category {
font-size: 77%;
}

#reco-desc {
font-size: 77%;
}

.replbq {
margin: 4px;
}

#ygrp-actbar div a:first-child {
/* border-right: 0px solid #000;*/
margin-right: 2px;
padding-right: 5px;
}

#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-mlmsg #logo {
padding-bottom: 10px;
}


#ygrp-msg p a {
font-family: Verdana;
}

#ygrp-msg p#attach-count span {
color: #1E66AE;
font-weight: 700;
}

#ygrp-reco #reco-head {
color: #ff7900;
font-weight: 700;
}

#ygrp-reco {
margin-bottom: 20px;
padding: 0px;
}

#ygrp-sponsor #ov li a {
font-size: 130%;
text-decoration: none;
}

#ygrp-sponsor #ov li {
font-size: 77%;
list-style-type: square;
padding: 6px 0;
}

#ygrp-sponsor #ov ul {
margin: 0;
padding: 0 0 0 8px;
}

#ygrp-text {
font-family: Georgia;
}

#ygrp-text p {
margin: 0 0 1em 0;
}

#ygrp-text tt {
font-size: 120%;
}

#ygrp-vital ul li:last-child {
border-right: none !important;
}
-->
</style>
</head>

<!--~-|**|PrettyHtmlEnd|**|-~-->
</html>
<!-- end group email -->
itamarnet@yahoo.com.br [shell-script]
2017-05-03 11:21:26 UTC
Permalink
Caro Dito

Que tal essa solução:


paste <(seq -f "%03g" 2 2 500 | shuf) <(ls meu_diretorio) | awk -F '\t' '{system("mv \042" $2 "\042 \042" $1 "-" $2 "\042")}'





Não sei no seu caso mas o "seq" comigo não preciso usar o " tr ' ' '\n' ", pois cada número já sai em uma linha distinta.
Talvez esse recurso só seja necessário se a construção fosse "echo {002..500..2}"


Obs.: O "\042" dentro do awk emula a aspas dupla ( " ) para a construção do comando.


Espero que ajude em algo


[]'s
Itamar
Alfredo Casanova atcasanova@gmail.com [shell-script]
2017-05-03 14:13:45 UTC
Permalink
Ah, no exemplo que enviei esqueci de colocar o step no echo. No seu caso,
mude o echo {1..399} para echo {2..500..2}
paste -d" " <(ls *.mp3 |sed -E 's/^|$/\"/g') <(paste -d- <(echo
{1..399}|tr ' ' '\n'|shuf) <(ls *.mp3)|sed -E 's/^|$/\"/g') | sed 's/^/mv
/g'
mv "Chico Buarque - Construção.mp3" "61-Chico Buarque - Construção.mp3"
mv "John Lennon - Imagine.mp3" "39-John Lennon - Imagine.mp3"
mv "Vinícius de Moraes - Garota de Ipanema.mp3" "241-Vinícius de Moraes -
Garota de Ipanema.mp3"
mv "Chico Buarque - Construção.mp3" "308-Chico Buarque - Construção.mp3"
mv "John Lennon - Imagine.mp3" "1-John Lennon - Imagine.mp3"
e aí é só adicionar um | bash no final e ele vai mover tudo
paste -d" " <(ls *.mp3 |sed -E 's/^|$/\"/g') <(paste -d- <(echo
{1..399}|tr ' ' '\n'|shuf) <(ls *.mp3)|sed -E 's/^|$/\"/g') | sed 's/^/mv
/g' | bash
Post by ***@yahoo.com.br [shell-script]
Caro Dito
paste <(seq -f "%03g" 2 2 500 | shuf) <(ls meu_diretorio) | awk -F '\t'
'{system("mv \042" $2 "\042 \042" $1 "-" $2 "\042")}'
Não sei no seu caso mas o "seq" comigo não preciso usar o " tr ' ' '\n'
", pois cada número já sai em uma linha distinta.
Talvez esse recurso só seja necessário se a construção fosse "echo
{002..500..2}"
Obs.: O "\042" dentro do awk emula a aspas dupla ( " ) para a construção
do comando.
Espero que ajude em algo
[]'s
Itamar
William Alves dos Santos williamalvessantos@gmail.com [shell-script]
2017-05-03 14:55:57 UTC
Permalink
Sua lógica esta sucinta, faria assim:
seq 1 500 | while read i; do (( $i % 2 == 0 )) && echo $i ; done | shuf
Vi que outras pessoas responderam também com o shuf
Espero ter ajudado
Att





On Wed, May 3, 2017 11:13 AM, Alfredo Casanova ***@gmail.com
[shell-script] shell-***@yahoogrupos.com.br wrote:


Ah, no exemplo que enviei esqueci de colocar o step no echo. No seu caso, mude o
echo {1..399} para echo {2..500..2}
On Wed, May 3, 2017 at 11:08 AM Alfredo Casanova <***@gmail.com> wrote:
Tem essa:
paste -d" " <(ls *.mp3 |sed -E 's/^|$/\"/g') <(paste -d- <(echo {1..399}|tr ' '
'\n'|shuf)  <(ls *.mp3)|sed -E 's/^|$/\"/g') | sed 's/^/mv /g'
isso vai produzir o seguinte resultado:mv "Chico Buarque - Construção.mp3"
"61-Chico Buarque - Construção.mp3"mv "John Lennon - Imagine.mp3" "39-John
Lennon - Imagine.mp3"mv "Vinícius de Moraes - Garota de Ipanema.mp3"
"241-Vinícius de Moraes - Garota de Ipanema.mp3"mv "Chico Buarque -
Construção.mp3" "308-Chico Buarque - Construção.mp3"mv "John Lennon -
Imagine.mp3" "1-John Lennon - Imagine.mp3"
e aí é só adicionar um | bash no final e ele vai mover tudo
paste -d" " <(ls *.mp3 |sed -E 's/^|$/\"/g') <(paste -d- <(echo {1..399}|tr ' '
'\n'|shuf)  <(ls *.mp3)|sed -E 's/^|$/\"/g') | sed 's/^/mv /g' | bash


On Wed, May 3, 2017 at 8:21 AM ***@yahoo.com.br [shell-script] <
shell-***@yahoogrupos.com.br> wrote:
Caro Dito


Que tal essa solução:
paste <(seq -f "%03g" 2 2 500 | shuf) <(ls meu_diretorio) | awk -F '\t'
'{system("mv \042" $2 "\042 \042" $1 "-" $2 "\042")}'


Não sei no seu caso mas o "seq" comigo não preciso usar o " tr ' ' '\n' ", pois
cada número já sai em uma linha distinta.Talvez esse recurso só seja necessário
se a construção fosse "echo {002..500..2}"
Obs.: O "\042" dentro do awk emula a aspas dupla ( " ) para a construção do
comando.
Espero que ajude em algo
[]'sItamar





Abraços

William Alves dos Santos
Cel.: (11) 99616 8602 - VIVO
Cel.: (11) 96835 8172 - TIM
Dito Ramos diramos@uol.com.br [shell-script]
2017-05-03 15:07:01 UTC
Permalink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>







<body style="background-color: #fff;">
<span style="display:none">&nbsp;</span>

<!--~-|**|PrettyHtmlStartT|**|-~-->
<div id="ygrp-mlmsg" style="position:relative;">
<div id="ygrp-msg" style="z-index: 1;">
<!--~-|**|PrettyHtmlEndT|**|-~-->

<div id="ygrp-text" >


<p>Mestre,<br>
<br>
Muito obrigado por todas as contribui&ccedil;&otilde;es.<br>
Vou testar cada uma e, logo mais, dou retorno.<br>
<br>
grato a todos.<br>
<br>
Dito <hr> <div><br> <strong>De: </strong>&quot;William Alves dos Santos ***@gmail.com [shell-script]&quot; &lt;shell-***@yahoogrupos.com.br&gt;<br>
<strong>Enviada: </strong>2017/05/03 11:56:07<br>
<strong>Para: </strong>shell-***@yahoogrupos.com.br<br>
<strong>Assunto: </strong> Re: [shell-script] Imprimir sequ&ecirc;ncia de n&uacute;meros randomicamente, SEM REPETI&Ccedil;&Atilde;O<br>
&nbsp;</div>
<span>&nbsp;</span>
<div id="ygrp-text">
<p><!--[if (gte mso 9)|(IE)]>

<div class='notviscode' style='display:none'>
a, body {
font-family: 'Calibri', Arial, sans-serif;
}

img {
border: none !important;
-ms-interpolation-mode:bicubic;
}

td {
mso-line-height-rule:exactly !important;
}

.mso-card-inner table {
border-collapse: collapse !important;
mso-table-lspace:0pt;
mso-table-rspace:0pt;
vertical-align: top;
}

.outlook-com-only {
display: none !important;
font-size: 0 !important;
}

#mso-one-whole {
width: 100% !important;
}



.border-outer,
.border-middle,
.border-inner {
border: none !important;
}

.border-middle,
.border-inner {
width: 100% !important;
}

.mso-border-outer,
.mso-border-middle,
.mso-border-inner {
padding: 1px;
}

.mso-border-outer { background-color: rgb(245, 255, 255); }
.mso-border-middle { background-color: rgb(223, 246, 255); }
.mso-border-inner { background-color: rgb(153, 176, 225); }

</div>

<![endif]--></p>

<table border="0" cellpadding="0" cellspacing="0" class="container" dir="ltr" lang="container" style="width: 100%;margin-top: 6px;" valign="top">
<tbody>
<tr>
<td class="message-wrapper" style="color: rgb(34, 34, 34);font-family: arial,sans-serif;" valign="top"><!--[if mso]><table border="0" cellpadding="0" cellspacing="0" valign="top" style="border-collapse:separate;"><tr><td valign="top"><![endif]-->
<div>Sua l&oacute;gica esta sucinta, faria assim:</div>

<div>&nbsp;</div>

<div>seq 1 500 | while read i; do (( $i % 2 == 0 )) &amp;&amp; echo $i ; done | shuf</div>

<div>&nbsp;</div>

<div>Vi que outras pessoas responderam tamb&eacute;m com o shuf</div>

<div>&nbsp;</div>

<div>Espero ter ajudado</div>

<div>&nbsp;</div>

<div>Att</div>
<img align="left" alt height="0" src="https://track.mixmax.com/api/track/v2/LUSXv5fdsNLDMmGL6/i02bj5CbpFWbnB0cvRnbhN3clZHbh1WYpxGbpdnI/iInYu02bj5ycvBXdyd2bvhWY5BEdwlmcjNXLsxWZoNnI/?sc=false" style="width: 0px;height: 0px;" width="0"> <!--[if mso]></td></tr></table><![endif]--></td>
</tr>
</tbody>
</table>

<div>
<div>
<p data="true">&nbsp;</p>

<div class="gmail_extra">
<p data="true">&nbsp;</p>

<div class="gmail_quote">On Wed, May 3, 2017 11:13 AM, Alfredo Casanova ***@gmail.com [shell-script] <span dir="ltr"> <a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a></span> wrote:

<blockquote class="gmail_quote" style="border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;"><span>&nbsp;</span>

<div id="ygrp-text">
<p>&nbsp;</p>

<div dir="ltr">Ah, no exemplo que enviei esqueci de colocar o step no echo. No seu caso, mude o echo {1..399} para echo {2..500..2}</div>
&nbsp; <div> <div dir="ltr">On Wed, May 3, 2017 at 11:08 AM Alfredo Casanova &lt;<a href="/compose?to=***@gmail.com" target="_blank">***@gmail.com</a>&gt; wrote:</div>

<blockquote style="margin: 0px 0px 0px 40px;border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div dir="ltr">Tem essa:
<div>&nbsp;</div>

<div>paste -d&quot; &quot; &lt;(ls *.mp3 |sed -E &#39;s/^|$/\&quot;/g&#39;) &lt;(paste -d- &lt;(echo {1..399}|tr &#39; &#39; &#39;\n&#39;|shuf) &nbsp;&lt;(ls *.mp3)|sed -E &#39;s/^|$/\&quot;/g&#39;) | sed &#39;s/^/mv /g&#39;&nbsp;</div>

<div>isso vai produzir o seguinte resultado:&nbsp;</div>

<div>mv &quot;Chico Buarque - Constru&ccedil;&atilde;o.mp3&quot; &quot;61-Chico Buarque - Constru&ccedil;&atilde;o.mp3&quot;</div>

<div>mv &quot;John Lennon - Imagine.mp3&quot; &quot;39-John Lennon - Imagine.mp3&quot;</div>

<div>mv &quot;Vin&iacute;cius de Moraes - Garota de Ipanema.mp3&quot; &quot;241-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3&quot;</div>

<div>mv &quot;Chico Buarque - Constru&ccedil;&atilde;o.mp3&quot; &quot;308-Chico Buarque - Constru&ccedil;&atilde;o.mp3&quot;</div>

<div>mv &quot;John Lennon - Imagine.mp3&quot; &quot;1-John Lennon - Imagine.mp3&quot;</div>

<div>&nbsp;</div>

<div>e a&iacute; &eacute; s&oacute; adicionar um | bash no final e ele vai mover tudo</div>

<div>&nbsp;</div>

<div>paste -d&quot; &quot; &lt;(ls *.mp3 |sed -E &#39;s/^|$/\&quot;/g&#39;) &lt;(paste -d- &lt;(echo {1..399}|tr &#39; &#39; &#39;\n&#39;|shuf) &nbsp;&lt;(ls *.mp3)|sed -E &#39;s/^|$/\&quot;/g&#39;) | sed &#39;s/^/mv /g&#39; | bash</div>

<div>&nbsp;</div>
</div>
&nbsp; <div> <div dir="ltr">On Wed, May 3, 2017 at 8:21 AM <a href="/compose?to=***@yahoo.com.br" target="_blank">***@yahoo.com.br</a> [shell-script] &lt;<a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt; wrote:</div>

<blockquote style="margin: 0px 0px 0px 40px;border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div style="background-color: rgb(255, 255, 255);"><span>&nbsp;</span>

<div id="m_-5236878472308590939m_-7553941849910139121ygrp-mlmsg">
<div id="m_-5236878472308590939m_-7553941849910139121ygrp-msg">
<div id="m_-5236878472308590939m_-7553941849910139121ygrp-text">
<p>Caro Dito</p>

<div>&nbsp;</div>

<div>Que tal essa solu&ccedil;&atilde;o:</div>

<div>&nbsp;</div>

<div>paste &lt;(seq -f &quot;%03g&quot; 2 2 500 | shuf) &lt;(ls meu_diretorio) | awk -F &#39;\t&#39; &#39;{system(&quot;mv \042&quot; $2 &quot;\042 \042&quot; $1 &quot;-&quot; $2 &quot;\042&quot;)}&#39;</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>N&atilde;o sei no seu caso mas o &quot;seq&quot; comigo n&atilde;o preciso usar o &quot; tr &#39; &#39; &#39;\n&#39; &quot;, pois cada n&uacute;mero j&aacute; sai em uma linha distinta.</div>

<div>Talvez esse recurso s&oacute; seja necess&aacute;rio se a constru&ccedil;&atilde;o fosse &quot;echo {002..500..2}&quot;</div>

<div>&nbsp;</div>

<div>Obs.: O &quot;\042&quot; dentro do awk emula a aspas dupla ( &quot; ) para a constru&ccedil;&atilde;o do comando.</div>

<div>&nbsp;</div>

<div>Espero que ajude em algo</div>

<div>&nbsp;</div>

<div>[]&#39;s</div>

<div>Itamar</div>

<p>&nbsp;</p>
</div>

<div style="height: 0px;color: rgb(255, 255, 255);">&nbsp;</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>

<p>&nbsp;</p>
</div>
<!-- end group email --></blockquote>
</div>
</div>
</div>
</div>
&nbsp;

<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div><span style="font-family: tahoma,sans-serif;">Abra&ccedil;os</span><br>
<br>
<b style="font-family: tahoma,sans-serif;">William Alves dos Santos</b></div>

<div><span style="font-family: tahoma,sans-serif;">Cel.: (11) 99616 8602 - VIVO</span><br>
<span><span style="font-family: tahoma,sans-serif;">Cel.: (11) 96835 8172 - TIM</span></span></div>
</div>
</div>
</div>
</div>
</div>

<p>&nbsp;</p>
</div>
<!-- end group email -->
</p>

</div>


<!--~-|**|PrettyHtmlStart|**|-~-->
<div style="color: #fff; height: 0;">__._,_.___</div>






<div style="clear:both"> </div>

<div id="fromDMARC" style="margin-top: 10px;">
<hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
Enviado por: Dito Ramos &lt;***@uol.com.br&gt; <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
</div>
<div style="clear:both"> </div>

<table cellspacing=4px style="margin-top: 10px; margin-bottom: 10px; color: #2D50FD;">
<tbody>
<tr>
<td style="font-size: 12px; font-family: arial; font-weight: bold; padding: 7px 5px 5px;" >
<a style="text-decoration: none; color: #2D50FD" href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/messages/40137;_ylc=X3oDMTJxZTBtZ2hpBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTM3BHNlYwNmdHIEc2xrA3JwbHkEc3RpbWUDMTQ5MzgyNDAyNQ--?act=reply&messageNum=40137">Responder através da web</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="mailto:***@uol.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD;">
</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;">
<a href="mailto:shell-***@yahoogrupos.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD">
através de email </a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/newtopic;_ylc=X3oDMTJlcmpudGY4BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTQ5MzgyNDAyNQ--" style="text-decoration: none; color: #2D50FD">Adicionar um novo tópico</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;color: #2D50FD;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/topics/40117;_ylc=X3oDMTM2NDNpa3JvBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTM3BHNlYwNmdHIEc2xrA3Z0cGMEc3RpbWUDMTQ5MzgyNDAyNQR0cGNJZAM0MDExNw--" style="text-decoration: none; color: #2D50FD;">Mensagens neste tópico</a>
(20)
</td>
</tr>
</tbody>
</table>



<!------- Start Nav Bar ------>
<!-- |**|begin egp html banner|**| -->
<!-- |**|end egp html banner|**| -->


<div id="ygrp-grfd" style="font-family: Verdana; font-size: 12px; padding: 15px 0;">

<!-- |**|begin egp html banner|**| -->

---------------------------------------------------------------------<BR>
Esta lista não admite a abordagem de outras liguagens de programação, como perl, C etc. Quem insistir em não seguir esta regra será moderado sem prévio aviso.<BR>
---------------------------------------------------------------------<BR>
Sair da lista: shell-script-***@yahoogrupos.com.br<BR>
---------------------------------------------------------------------<BR>
Esta lista é moderada de acordo com o previsto em <a href="http://www.listas-discussao.cjb.net">http://www.listas-discussao.cjb.net</a><BR>
---------------------------------------------------------------------<BR>
Servidor Newsgroup da lista: news.gmane.org<BR>
Grupo: gmane.org.user-groups.programming.shell.brazil<BR>
<BR>

<!-- |**|end egp html banner|**| -->

</div>




<!-- |**|begin egp html banner|**| -->
<div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

<span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; "><a href="https://br.groups.yahoo.com/neo/groups/shell-script/info;_ylc=X3oDMTJlN3NtbXQxBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ5MzgyNDAyNQ--" style="text-decoration: none;">Visite seu Grupo</a></span>

<ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
</ul>
</div>


<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
<a href="https://br.groups.yahoo.com/neo;_ylc=X3oDMTJkNGFva2kwBF9TAzk3NDkwNDM1BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDkzODI0MDI1" style="float: left;"><img src="http://l.yimg.com/ru/static/images/yg/img/email/new_logo/yahoo_groups_pt-BR_141x19.png" height="19" width="141" alt="Yahoo! Grupos" style="border: 0;"/></a>
<div style="color: #747575; float: right;"> &bull; <a href="https://info.yahoo.com/privacy/br/yahoo/groups/details.html" style="text-decoration: none;">Privacidade</a> &bull; <a href="mailto:shell-script-***@yahoogrupos.com.br?subject=Sair do grupo" style="text-decoration: none;">Sair do grupo</a> &bull; <a href="https://info.yahoo.com/legal/br/yahoo/utos/terms/" style="text-decoration: none;">Termos de uso</a> </div>
</div>
<br>

<!-- |**|end egp html banner|**| -->

</div> <!-- ygrp-msg -->


<!-- Sponsor -->
<!-- |**|begin egp html banner|**| -->
<div id="ygrp-sponsor" style="width:160px; float:right; clear:none; margin:0 0 25px 0; background: #fff;">

<!-- Start Recommendations -->
<div id="ygrp-reco">
</div>
<!-- End Recommendations -->



</div> <!-- |**|end egp html banner|**| -->

<div style="clear:both; color: #FFF; font-size:1px;">.</div>
</div>

<img src="http://geo.yahoo.com/serv?s=97490437/grpId=1941312/grpspId=2137111254/msgId=40137/stime=1493824025" width="1" height="1"> <br>

<img src="http://y.analytics.yahoo.com/fpc.pl?ywarid=515FB27823A7407E&a=10001310322279&js=no&resp=img" width="1" height="1">

<div style="color: #fff; height: 0;">__,_._,___</div>
<!--~-|**|PrettyHtmlEnd|**|-~-->

</body>

<!--~-|**|PrettyHtmlStart|**|-~-->
<head>
<style type="text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}

#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}

#ygrp-mkp #ads {
margin-bottom: 10px;
}

#ygrp-mkp .ad {
padding: 0 0;
}

#ygrp-mkp .ad p {
margin: 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: 700;
font-size: 78%;
line-height: 122%;
}

#ygrp-sponsor #ygrp-lc .ad {
margin-bottom: 10px;
padding: 0 0;
}

#actions {
font-family: Verdana;
font-size: 11px;
padding: 10px 0;
}

#activity {
background-color: #e0ecee;
float: left;
font-family: Verdana;
font-size: 10px;
padding: 10px;
}

#activity span {
font-weight: 700;
}

#activity span:first-child {
text-transform: uppercase;
}

#activity span a {
color: #5085b6;
text-decoration: none;
}

#activity span span {
color: #ff7900;
}

#activity span .underline {
text-decoration: underline;
}

.attach {
clear: both;
display: table;
font-family: Arial;
font-size: 12px;
padding: 10px 0;
width: 400px;
}

.attach div a {
text-decoration: none;
}

.attach img {
border: none;
padding-right: 5px;
}

.attach label {
display: block;
margin-bottom: 5px;
}

.attach label a {
text-decoration: none;
}

blockquote {
margin: 0 0 0 4px;
}

.bold {
font-family: Arial;
font-size: 13px;
font-weight: 700;
}

.bold a {
text-decoration: none;
}

dd.last p a {
font-family: Verdana;
font-weight: 700;
}

dd.last p span {
margin-right: 10px;
font-family: Verdana;
font-weight: 700;
}

dd.last p span.yshortcuts {
margin-right: 0;
}

div.attach-table div div a {
text-decoration: none;
}

div.attach-table {
width: 400px;
}

div.file-title a, div.file-title a:active, div.file-title a:hover, div.file-title a:visited {
text-decoration: none;
}

div.photo-title a, div.photo-title a:active, div.photo-title a:hover, div.photo-title a:visited {
text-decoration: none;
}

div#ygrp-mlmsg #ygrp-msg p a span.yshortcuts {
font-family: Verdana;
font-size: 10px;
font-weight: normal;
}

.green {
color: #628c2a;
}

.MsoNormal {
margin: 0 0 0 0;
}

o {
font-size: 0;
}

#photos div {
float: left;
width: 72px;
}

#photos div div {
border: 1px solid #666666;
height: 62px;
overflow: hidden;
width: 62px;
}

#photos div label {
color: #666666;
font-size: 10px;
overflow: hidden;
text-align: center;
white-space: nowrap;
width: 64px;
}

#reco-category {
font-size: 77%;
}

#reco-desc {
font-size: 77%;
}

.replbq {
margin: 4px;
}

#ygrp-actbar div a:first-child {
/* border-right: 0px solid #000;*/
margin-right: 2px;
padding-right: 5px;
}

#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-mlmsg #logo {
padding-bottom: 10px;
}


#ygrp-msg p a {
font-family: Verdana;
}

#ygrp-msg p#attach-count span {
color: #1E66AE;
font-weight: 700;
}

#ygrp-reco #reco-head {
color: #ff7900;
font-weight: 700;
}

#ygrp-reco {
margin-bottom: 20px;
padding: 0px;
}

#ygrp-sponsor #ov li a {
font-size: 130%;
text-decoration: none;
}

#ygrp-sponsor #ov li {
font-size: 77%;
list-style-type: square;
padding: 6px 0;
}

#ygrp-sponsor #ov ul {
margin: 0;
padding: 0 0 0 8px;
}

#ygrp-text {
font-family: Georgia;
}

#ygrp-text p {
margin: 0 0 1em 0;
}

#ygrp-text tt {
font-size: 120%;
}

#ygrp-vital ul li:last-child {
border-right: none !important;
}
-->
</style>
</head>

<!--~-|**|PrettyHtmlEnd|**|-~-->
</html>
<!-- end group email -->
Dito Ramos diramos@uol.com.br [shell-script]
2017-05-03 17:45:16 UTC
Permalink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>







<body style="background-color: #fff;">
<span style="display:none">&nbsp;</span>

<!--~-|**|PrettyHtmlStartT|**|-~-->
<div id="ygrp-mlmsg" style="position:relative;">
<div id="ygrp-msg" style="z-index: 1;">
<!--~-|**|PrettyHtmlEndT|**|-~-->

<div id="ygrp-text" >


<p>Itamar e Casanova.<br>
Ambas as solu&ccedil;&otilde;es funcionaram perfeitamente.<br>
Obrigado a todos por mais essa for&ccedil;a.<br>
<br>
Dito <hr> <div><br> <strong>De: </strong>&quot;William Alves dos Santos ***@gmail.com [shell-script]&quot; &lt;shell-***@yahoogrupos.com.br&gt;<br>
<strong>Enviada: </strong>2017/05/03 11:56:07<br>
<strong>Para: </strong>shell-***@yahoogrupos.com.br<br>
<strong>Assunto: </strong> Re: [shell-script] Imprimir sequ&ecirc;ncia de n&uacute;meros randomicamente, SEM REPETI&Ccedil;&Atilde;O<br>
&nbsp;</div>
<span>&nbsp;</span>
<div id="ygrp-text">
<p><!--[if (gte mso 9)|(IE)]>

<div class='notviscode' style='display:none'>
a, body {
font-family: 'Calibri', Arial, sans-serif;
}

img {
border: none !important;
-ms-interpolation-mode:bicubic;
}

td {
mso-line-height-rule:exactly !important;
}

.mso-card-inner table {
border-collapse: collapse !important;
mso-table-lspace:0pt;
mso-table-rspace:0pt;
vertical-align: top;
}

.outlook-com-only {
display: none !important;
font-size: 0 !important;
}

#mso-one-whole {
width: 100% !important;
}



.border-outer,
.border-middle,
.border-inner {
border: none !important;
}

.border-middle,
.border-inner {
width: 100% !important;
}

.mso-border-outer,
.mso-border-middle,
.mso-border-inner {
padding: 1px;
}

.mso-border-outer { background-color: rgb(245, 255, 255); }
.mso-border-middle { background-color: rgb(223, 246, 255); }
.mso-border-inner { background-color: rgb(153, 176, 225); }

</div>

<![endif]--></p>

<table border="0" cellpadding="0" cellspacing="0" class="container" dir="ltr" lang="container" style="width: 100%;margin-top: 6px;" valign="top">
<tbody>
<tr>
<td class="message-wrapper" style="color: rgb(34, 34, 34);font-family: arial,sans-serif;" valign="top"><!--[if mso]><table border="0" cellpadding="0" cellspacing="0" valign="top" style="border-collapse:separate;"><tr><td valign="top"><![endif]-->
<div>Sua l&oacute;gica esta sucinta, faria assim:</div>

<div>&nbsp;</div>

<div>seq 1 500 | while read i; do (( $i % 2 == 0 )) &amp;&amp; echo $i ; done | shuf</div>

<div>&nbsp;</div>

<div>Vi que outras pessoas responderam tamb&eacute;m com o shuf</div>

<div>&nbsp;</div>

<div>Espero ter ajudado</div>

<div>&nbsp;</div>

<div>Att</div>
<img align="left" alt height="0" src="https://track.mixmax.com/api/track/v2/LUSXv5fdsNLDMmGL6/i02bj5CbpFWbnB0cvRnbhN3clZHbh1WYpxGbpdnI/iInYu02bj5ycvBXdyd2bvhWY5BEdwlmcjNXLsxWZoNnI/?sc=false" style="width: 0px;height: 0px;" width="0"> <!--[if mso]></td></tr></table><![endif]--></td>
</tr>
</tbody>
</table>

<div>
<div>
<p data="true">&nbsp;</p>

<div class="gmail_extra">
<p data="true">&nbsp;</p>

<div class="gmail_quote">On Wed, May 3, 2017 11:13 AM, Alfredo Casanova ***@gmail.com [shell-script] <span dir="ltr"> <a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a></span> wrote:

<blockquote class="gmail_quote" style="border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;"><span>&nbsp;</span>

<div id="ygrp-text">
<p>&nbsp;</p>

<div dir="ltr">Ah, no exemplo que enviei esqueci de colocar o step no echo. No seu caso, mude o echo {1..399} para echo {2..500..2}</div>
&nbsp; <div> <div dir="ltr">On Wed, May 3, 2017 at 11:08 AM Alfredo Casanova &lt;<a href="/compose?to=***@gmail.com" target="_blank">***@gmail.com</a>&gt; wrote:</div>

<blockquote style="margin: 0px 0px 0px 40px;border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div dir="ltr">Tem essa:
<div>&nbsp;</div>

<div>paste -d&quot; &quot; &lt;(ls *.mp3 |sed -E &#39;s/^|$/\&quot;/g&#39;) &lt;(paste -d- &lt;(echo {1..399}|tr &#39; &#39; &#39;\n&#39;|shuf) &nbsp;&lt;(ls *.mp3)|sed -E &#39;s/^|$/\&quot;/g&#39;) | sed &#39;s/^/mv /g&#39;&nbsp;</div>

<div>isso vai produzir o seguinte resultado:&nbsp;</div>

<div>mv &quot;Chico Buarque - Constru&ccedil;&atilde;o.mp3&quot; &quot;61-Chico Buarque - Constru&ccedil;&atilde;o.mp3&quot;</div>

<div>mv &quot;John Lennon - Imagine.mp3&quot; &quot;39-John Lennon - Imagine.mp3&quot;</div>

<div>mv &quot;Vin&iacute;cius de Moraes - Garota de Ipanema.mp3&quot; &quot;241-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3&quot;</div>

<div>mv &quot;Chico Buarque - Constru&ccedil;&atilde;o.mp3&quot; &quot;308-Chico Buarque - Constru&ccedil;&atilde;o.mp3&quot;</div>

<div>mv &quot;John Lennon - Imagine.mp3&quot; &quot;1-John Lennon - Imagine.mp3&quot;</div>

<div>&nbsp;</div>

<div>e a&iacute; &eacute; s&oacute; adicionar um | bash no final e ele vai mover tudo</div>

<div>&nbsp;</div>

<div>paste -d&quot; &quot; &lt;(ls *.mp3 |sed -E &#39;s/^|$/\&quot;/g&#39;) &lt;(paste -d- &lt;(echo {1..399}|tr &#39; &#39; &#39;\n&#39;|shuf) &nbsp;&lt;(ls *.mp3)|sed -E &#39;s/^|$/\&quot;/g&#39;) | sed &#39;s/^/mv /g&#39; | bash</div>

<div>&nbsp;</div>
</div>
&nbsp; <div> <div dir="ltr">On Wed, May 3, 2017 at 8:21 AM <a href="/compose?to=***@yahoo.com.br" target="_blank">***@yahoo.com.br</a> [shell-script] &lt;<a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt; wrote:</div>

<blockquote style="margin: 0px 0px 0px 40px;border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div style="background-color: rgb(255, 255, 255);"><span>&nbsp;</span>

<div id="m_-5236878472308590939m_-7553941849910139121ygrp-mlmsg">
<div id="m_-5236878472308590939m_-7553941849910139121ygrp-msg">
<div id="m_-5236878472308590939m_-7553941849910139121ygrp-text">
<p>Caro Dito</p>

<div>&nbsp;</div>

<div>Que tal essa solu&ccedil;&atilde;o:</div>

<div>&nbsp;</div>

<div>paste &lt;(seq -f &quot;%03g&quot; 2 2 500 | shuf) &lt;(ls meu_diretorio) | awk -F &#39;\t&#39; &#39;{system(&quot;mv \042&quot; $2 &quot;\042 \042&quot; $1 &quot;-&quot; $2 &quot;\042&quot;)}&#39;</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>N&atilde;o sei no seu caso mas o &quot;seq&quot; comigo n&atilde;o preciso usar o &quot; tr &#39; &#39; &#39;\n&#39; &quot;, pois cada n&uacute;mero j&aacute; sai em uma linha distinta.</div>

<div>Talvez esse recurso s&oacute; seja necess&aacute;rio se a constru&ccedil;&atilde;o fosse &quot;echo {002..500..2}&quot;</div>

<div>&nbsp;</div>

<div>Obs.: O &quot;\042&quot; dentro do awk emula a aspas dupla ( &quot; ) para a constru&ccedil;&atilde;o do comando.</div>

<div>&nbsp;</div>

<div>Espero que ajude em algo</div>

<div>&nbsp;</div>

<div>[]&#39;s</div>

<div>Itamar</div>

<p>&nbsp;</p>
</div>

<div style="height: 0px;color: rgb(255, 255, 255);">&nbsp;</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>

<p>&nbsp;</p>
</div>
<!-- end group email --></blockquote>
</div>
</div>
</div>
</div>
&nbsp;

<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div><span style="font-family: tahoma,sans-serif;">Abra&ccedil;os</span><br>
<br>
<b style="font-family: tahoma,sans-serif;">William Alves dos Santos</b></div>

<div><span style="font-family: tahoma,sans-serif;">Cel.: (11) 99616 8602 - VIVO</span><br>
<span><span style="font-family: tahoma,sans-serif;">Cel.: (11) 96835 8172 - TIM</span></span></div>
</div>
</div>
</div>
</div>
</div>

<p>&nbsp;</p>
</div>
<!-- end group email -->
</p>

</div>


<!--~-|**|PrettyHtmlStart|**|-~-->
<div style="color: #fff; height: 0;">__._,_.___</div>






<div style="clear:both"> </div>

<div id="fromDMARC" style="margin-top: 10px;">
<hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
Enviado por: Dito Ramos &lt;***@uol.com.br&gt; <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
</div>
<div style="clear:both"> </div>

<table cellspacing=4px style="margin-top: 10px; margin-bottom: 10px; color: #2D50FD;">
<tbody>
<tr>
<td style="font-size: 12px; font-family: arial; font-weight: bold; padding: 7px 5px 5px;" >
<a style="text-decoration: none; color: #2D50FD" href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/messages/40139;_ylc=X3oDMTJxb21hazh0BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTM5BHNlYwNmdHIEc2xrA3JwbHkEc3RpbWUDMTQ5MzgzMzUyNQ--?act=reply&messageNum=40139">Responder através da web</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="mailto:***@uol.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD;">
</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;">
<a href="mailto:shell-***@yahoogrupos.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD">
através de email </a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/newtopic;_ylc=X3oDMTJlcHE1ZjBnBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTQ5MzgzMzUyNQ--" style="text-decoration: none; color: #2D50FD">Adicionar um novo tópico</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;color: #2D50FD;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/topics/40117;_ylc=X3oDMTM2ZGNzMzI2BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTM5BHNlYwNmdHIEc2xrA3Z0cGMEc3RpbWUDMTQ5MzgzMzUyNQR0cGNJZAM0MDExNw--" style="text-decoration: none; color: #2D50FD;">Mensagens neste tópico</a>
(22)
</td>
</tr>
</tbody>
</table>



<!------- Start Nav Bar ------>
<!-- |**|begin egp html banner|**| -->
<!-- |**|end egp html banner|**| -->


<div id="ygrp-grfd" style="font-family: Verdana; font-size: 12px; padding: 15px 0;">

<!-- |**|begin egp html banner|**| -->

---------------------------------------------------------------------<BR>
Esta lista não admite a abordagem de outras liguagens de programação, como perl, C etc. Quem insistir em não seguir esta regra será moderado sem prévio aviso.<BR>
---------------------------------------------------------------------<BR>
Sair da lista: shell-script-***@yahoogrupos.com.br<BR>
---------------------------------------------------------------------<BR>
Esta lista é moderada de acordo com o previsto em <a href="http://www.listas-discussao.cjb.net">http://www.listas-discussao.cjb.net</a><BR>
---------------------------------------------------------------------<BR>
Servidor Newsgroup da lista: news.gmane.org<BR>
Grupo: gmane.org.user-groups.programming.shell.brazil<BR>
<BR>

<!-- |**|end egp html banner|**| -->

</div>




<!-- |**|begin egp html banner|**| -->
<div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

<span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; "><a href="https://br.groups.yahoo.com/neo/groups/shell-script/info;_ylc=X3oDMTJlcWVtOTZoBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ5MzgzMzUyNQ--" style="text-decoration: none;">Visite seu Grupo</a></span>

<ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
</ul>
</div>


<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
<a href="https://br.groups.yahoo.com/neo;_ylc=X3oDMTJkdGFiN20xBF9TAzk3NDkwNDM1BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDkzODMzNTI1" style="float: left;"><img src="http://l.yimg.com/ru/static/images/yg/img/email/new_logo/yahoo_groups_pt-BR_141x19.png" height="19" width="141" alt="Yahoo! Grupos" style="border: 0;"/></a>
<div style="color: #747575; float: right;"> &bull; <a href="https://info.yahoo.com/privacy/br/yahoo/groups/details.html" style="text-decoration: none;">Privacidade</a> &bull; <a href="mailto:shell-script-***@yahoogrupos.com.br?subject=Sair do grupo" style="text-decoration: none;">Sair do grupo</a> &bull; <a href="https://info.yahoo.com/legal/br/yahoo/utos/terms/" style="text-decoration: none;">Termos de uso</a> </div>
</div>
<br>

<!-- |**|end egp html banner|**| -->

</div> <!-- ygrp-msg -->


<!-- Sponsor -->
<!-- |**|begin egp html banner|**| -->
<div id="ygrp-sponsor" style="width:160px; float:right; clear:none; margin:0 0 25px 0; background: #fff;">

<!-- Start Recommendations -->
<div id="ygrp-reco">
</div>
<!-- End Recommendations -->



</div> <!-- |**|end egp html banner|**| -->

<div style="clear:both; color: #FFF; font-size:1px;">.</div>
</div>

<img src="http://geo.yahoo.com/serv?s=97490437/grpId=1941312/grpspId=2137111254/msgId=40139/stime=1493833525" width="1" height="1"> <br>

<img src="http://y.analytics.yahoo.com/fpc.pl?ywarid=515FB27823A7407E&a=10001310322279&js=no&resp=img" width="1" height="1">

<div style="color: #fff; height: 0;">__,_._,___</div>
<!--~-|**|PrettyHtmlEnd|**|-~-->

</body>

<!--~-|**|PrettyHtmlStart|**|-~-->
<head>
<style type="text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}

#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}

#ygrp-mkp #ads {
margin-bottom: 10px;
}

#ygrp-mkp .ad {
padding: 0 0;
}

#ygrp-mkp .ad p {
margin: 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: 700;
font-size: 78%;
line-height: 122%;
}

#ygrp-sponsor #ygrp-lc .ad {
margin-bottom: 10px;
padding: 0 0;
}

#actions {
font-family: Verdana;
font-size: 11px;
padding: 10px 0;
}

#activity {
background-color: #e0ecee;
float: left;
font-family: Verdana;
font-size: 10px;
padding: 10px;
}

#activity span {
font-weight: 700;
}

#activity span:first-child {
text-transform: uppercase;
}

#activity span a {
color: #5085b6;
text-decoration: none;
}

#activity span span {
color: #ff7900;
}

#activity span .underline {
text-decoration: underline;
}

.attach {
clear: both;
display: table;
font-family: Arial;
font-size: 12px;
padding: 10px 0;
width: 400px;
}

.attach div a {
text-decoration: none;
}

.attach img {
border: none;
padding-right: 5px;
}

.attach label {
display: block;
margin-bottom: 5px;
}

.attach label a {
text-decoration: none;
}

blockquote {
margin: 0 0 0 4px;
}

.bold {
font-family: Arial;
font-size: 13px;
font-weight: 700;
}

.bold a {
text-decoration: none;
}

dd.last p a {
font-family: Verdana;
font-weight: 700;
}

dd.last p span {
margin-right: 10px;
font-family: Verdana;
font-weight: 700;
}

dd.last p span.yshortcuts {
margin-right: 0;
}

div.attach-table div div a {
text-decoration: none;
}

div.attach-table {
width: 400px;
}

div.file-title a, div.file-title a:active, div.file-title a:hover, div.file-title a:visited {
text-decoration: none;
}

div.photo-title a, div.photo-title a:active, div.photo-title a:hover, div.photo-title a:visited {
text-decoration: none;
}

div#ygrp-mlmsg #ygrp-msg p a span.yshortcuts {
font-family: Verdana;
font-size: 10px;
font-weight: normal;
}

.green {
color: #628c2a;
}

.MsoNormal {
margin: 0 0 0 0;
}

o {
font-size: 0;
}

#photos div {
float: left;
width: 72px;
}

#photos div div {
border: 1px solid #666666;
height: 62px;
overflow: hidden;
width: 62px;
}

#photos div label {
color: #666666;
font-size: 10px;
overflow: hidden;
text-align: center;
white-space: nowrap;
width: 64px;
}

#reco-category {
font-size: 77%;
}

#reco-desc {
font-size: 77%;
}

.replbq {
margin: 4px;
}

#ygrp-actbar div a:first-child {
/* border-right: 0px solid #000;*/
margin-right: 2px;
padding-right: 5px;
}

#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-mlmsg #logo {
padding-bottom: 10px;
}


#ygrp-msg p a {
font-family: Verdana;
}

#ygrp-msg p#attach-count span {
color: #1E66AE;
font-weight: 700;
}

#ygrp-reco #reco-head {
color: #ff7900;
font-weight: 700;
}

#ygrp-reco {
margin-bottom: 20px;
padding: 0px;
}

#ygrp-sponsor #ov li a {
font-size: 130%;
text-decoration: none;
}

#ygrp-sponsor #ov li {
font-size: 77%;
list-style-type: square;
padding: 6px 0;
}

#ygrp-sponsor #ov ul {
margin: 0;
padding: 0 0 0 8px;
}

#ygrp-text {
font-family: Georgia;
}

#ygrp-text p {
margin: 0 0 1em 0;
}

#ygrp-text tt {
font-size: 120%;
}

#ygrp-vital ul li:last-child {
border-right: none !important;
}
-->
</style>
</head>

<!--~-|**|PrettyHtmlEnd|**|-~-->
</html>
<!-- end group email -->

Alfredo Casanova atcasanova@gmail.com [shell-script]
2017-05-03 14:16:17 UTC
Permalink
$ ls
a A b B c C d D e E f F g G h H i I j J k K l L m
M n N o O p P q Q r R s S t T u U v V w W x X y Y
z Z
$ ls | wc -l
52
$ paste -d" " <(ls * |sed -E 's/^|$/\"/g') <(paste -d- <(echo {1..52}|tr '
' '\n'|shuf) <(ls *)|sed -E 's/^|$/\"/g') | sed 's/^/mv /g'
mv "a" "46-a"
mv "A" "45-A"
mv "b" "4-b"
mv "B" "51-B"
mv "c" "8-c"
mv "C" "37-C"
mv "d" "42-d"
mv "D" "7-D"
mv "e" "33-e"
mv "E" "38-E"
mv "f" "14-f"
mv "F" "47-F"
mv "g" "28-g"
mv "G" "44-G"
mv "h" "39-h"
mv "H" "13-H"
mv "i" "5-i"
mv "I" "24-I"
mv "j" "20-j"
mv "J" "23-J"
mv "k" "9-k"
mv "K" "6-K"
mv "l" "18-l"
mv "L" "10-L"
mv "m" "22-m"
mv "M" "31-M"
mv "n" "50-n"
mv "N" "49-N"
mv "o" "15-o"
mv "O" "35-O"
mv "p" "16-p"
mv "P" "30-P"
mv "q" "43-q"
mv "Q" "1-Q"
mv "r" "34-r"
mv "R" "17-R"
mv "s" "29-s"
mv "S" "21-S"
mv "t" "12-t"
mv "T" "11-T"
mv "u" "41-u"
mv "U" "2-U"
mv "v" "36-v"
mv "V" "26-V"
mv "w" "19-w"
mv "W" "32-W"
mv "x" "25-x"
mv "X" "3-X"
mv "y" "27-y"
mv "Y" "52-Y"
mv "z" "40-z"
mv "Z" "48-Z"
$ paste -d" " <(ls|sed -E 's/^|$/\"/g') <(paste -d- <(echo {1..52}|tr ' '
'\n'|shuf) <(ls)|sed -E 's/^|$/\"/g') | sed 's/^/mv /g' | bash
$ ls
10-M 12-j 14-B 16-Z 18-u 1-T 21-f 23-D 25-I 27-w 29-i 30-U
32-n 34-L 36-r 38-h 3-k 41-d 43-F 45-Q 47-c 49-X 50-o 52-x
6-O 8-y
11-s 13-R 15-q 17-E 19-G 20-e 22-H 24-V 26-A 28-J 2-g 31-P
33-b 35-v 37-t 39-S 40-K 42-Y 44-m 46-z 48-C 4-N 51-W 5-p
7-a 9-l
Post by Alfredo Casanova ***@gmail.com [shell-script]
Ah, no exemplo que enviei esqueci de colocar o step no echo. No seu caso,
mude o echo {1..399} para echo {2..500..2}
paste -d" " <(ls *.mp3 |sed -E 's/^|$/\"/g') <(paste -d- <(echo
{1..399}|tr ' ' '\n'|shuf) <(ls *.mp3)|sed -E 's/^|$/\"/g') | sed 's/^/mv
/g'
mv "Chico Buarque - Construção.mp3" "61-Chico Buarque - Construção.mp3"
mv "John Lennon - Imagine.mp3" "39-John Lennon - Imagine.mp3"
mv "Vinícius de Moraes - Garota de Ipanema.mp3" "241-Vinícius de Moraes -
Garota de Ipanema.mp3"
mv "Chico Buarque - Construção.mp3" "308-Chico Buarque - Construção.mp3"
mv "John Lennon - Imagine.mp3" "1-John Lennon - Imagine.mp3"
e aí é só adicionar um | bash no final e ele vai mover tudo
paste -d" " <(ls *.mp3 |sed -E 's/^|$/\"/g') <(paste -d- <(echo
{1..399}|tr ' ' '\n'|shuf) <(ls *.mp3)|sed -E 's/^|$/\"/g') | sed 's/^/mv
/g' | bash
Post by ***@yahoo.com.br [shell-script]
Caro Dito
paste <(seq -f "%03g" 2 2 500 | shuf) <(ls meu_diretorio) | awk -F '\t'
'{system("mv \042" $2 "\042 \042" $1 "-" $2 "\042")}'
Não sei no seu caso mas o "seq" comigo não preciso usar o " tr ' ' '\n'
", pois cada número já sai em uma linha distinta.
Talvez esse recurso só seja necessário se a construção fosse "echo
{002..500..2}"
Obs.: O "\042" dentro do awk emula a aspas dupla ( " ) para a construção
do comando.
Espero que ajude em algo
[]'s
Itamar
Dito Ramos diramos@uol.com.br [shell-script]
2017-05-02 15:56:13 UTC
Permalink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>







<body style="background-color: #fff;">
<span style="display:none">&nbsp;</span>

<!--~-|**|PrettyHtmlStartT|**|-~-->
<div id="ygrp-mlmsg" style="position:relative;">
<div id="ygrp-msg" style="z-index: 1;">
<!--~-|**|PrettyHtmlEndT|**|-~-->

<div id="ygrp-text" >


<p>Ok, Casanova.<br>
Deixa eu terminar aqui que mando o c&oacute;digo.<br>
<br>
At&eacute; mais.<br>
<br>
Dito <hr> <div><br> <strong>De: </strong>&quot;Alfredo Casanova ***@gmail.com [shell-script]&quot; &lt;shell-***@yahoogrupos.com.br&gt;<br>
<strong>Enviada: </strong>2017/05/02 12:28:59<br>
<strong>Para: </strong>shell-***@yahoogrupos.com.br<br>
<strong>Assunto: </strong> Re: [shell-script] Imprimir sequ&ecirc;ncia de n&uacute;meros randomicamente, SEM REPETI&Ccedil;&Atilde;O<br>
&nbsp;</div>
<span>&nbsp;</span>
<div id="ygrp-text">
<p>&nbsp;</p>

<p dir="ltr">Ah, e manda o c&oacute;digo pra gente ver!</p>
&nbsp; <div class="gmail_quote"> <div dir="ltr">Em Ter, 2 de mai de 2017 12:27, Alfredo Casanova &lt;<a href="/compose?to=***@gmail.com" target="_blank">***@gmail.com</a>&gt; escreveu:</div>

<blockquote class="gmail_quote" style="border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<p dir="ltr">Eu n&atilde;o recebi o email do Itamar!</p>
&nbsp; <div class="gmail_quote"> <div dir="ltr">Em Ter, 2 de mai de 2017 12:11, Dito Ramos <a href="/compose?to=***@uol.com.br" target="_blank">***@uol.com.br</a> [shell-script] &lt;<a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt; escreveu:</div>

<blockquote class="gmail_quote" style="border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div style="background-color: rgb(255, 255, 255);"><span>&nbsp;</span>

<div id="m_4673599552032884819m_-8075458350875350580ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-msg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-text">
<p>Casanova, Leslie e Itamar.<br>
Atrav&eacute;s de suas preciosas sugest&otilde;es, j&aacute; consegui chegar a uma solu&ccedil;&atilde;o para o caso.<br>
MUITO obrigado mais uma vez a todos.<br>
<br>
Dito</p> <hr> <div>&nbsp;</div> <p>&nbsp;</p> </div> </div> </div> </div> <div style="background-color: rgb(255, 255, 255);"> <div id="m_4673599552032884819m_-8075458350875350580ygrp-mlmsg"> <div id="m_4673599552032884819m_-8075458350875350580ygrp-msg"> <div id="m_4673599552032884819m_-8075458350875350580ygrp-text"> <p>&nbsp;</p> <div><br> <strong>De: </strong>&quot;Alfredo Casanova <a href="/compose?to=***@gmail.com" target="_blank">***@gmail.com</a> [shell-script]&quot; &lt;<a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt;</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-msg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-text">
<p>&nbsp;</p>

<div><strong>Enviada: </strong>2017/05/02 12:05:18</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-msg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-text">
<p>&nbsp;</p>

<div><br>
<strong>Para: </strong><a href="/compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a><br>
<strong>Assunto: </strong> Re: [shell-script] Imprimir sequ&ecirc;ncia de n&uacute;meros randomicamente, SEM REPETI&Ccedil;&Atilde;O<br>
&nbsp;</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-msg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-text">
<p>&nbsp;</p>

<div>&nbsp;</div>
<span>&nbsp;</span>

<div id="m_4673599552032884819m_-8075458350875350580ygrp-text">
<p>&nbsp;</p>

<div dir="ltr">Dito, olha isso:&nbsp;</div>
</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-msg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-text">
<p>&nbsp;</p>

<div id="m_4673599552032884819m_-8075458350875350580ygrp-text">
<div dir="ltr">
<div>&nbsp;</div>

<div>criei uma lista com 399 &quot;musicas&quot;:</div>

<div>$ wc -l lista&nbsp;</div>

<div>399 lista</div>

<div>&nbsp;</div>

<div>ent&atilde;o fiz:&nbsp;</div>

<div>paste -d- &lt;(echo {1..399} | tr &#39; &#39; &#39;\n&#39; | shuf)&nbsp;&nbsp;&lt;(cat lista)</div>

<div>
<div>57-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>198-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>83-John Lennon - Imagine.mp3</div>

<div>272-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>278-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>106-John Lennon - Imagine.mp3</div>

<div>234-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>308-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>355-John Lennon - Imagine.mp3</div>

<div>292-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>20-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>165-John Lennon - Imagine.mp3</div>

<div>315-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>275-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>366-John Lennon - Imagine.mp3</div>

<div>280-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>16-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>8-John Lennon - Imagine.mp3</div>

<div>251-Vin&iacute;cius de Moraes - Garota de Ipanema.mp3</div>

<div>3-Chico Buarque - Constru&ccedil;&atilde;o.mp3</div>

<div>382-John Lennon - Imagine.mp3</div>

<div>&nbsp;</div>

<div>e por a&iacute; vai</div>
<br>
<br>
&nbsp;</div> </div> </div> <p>&nbsp;</p> </div> </div> </div> </div> <div style="background-color: rgb(255, 255, 255);"> <div id="m_4673599552032884819m_-8075458350875350580ygrp-mlmsg"> <div id="m_4673599552032884819m_-8075458350875350580ygrp-msg"> <div id="m_4673599552032884819m_-8075458350875350580ygrp-text"> <p>&nbsp;</p> <div id="m_4673599552032884819m_-8075458350875350580ygrp-text">&nbsp; <div class="gmail_quote"> <div dir="ltr">On Tue, May 2, 2017 at 11:51 AM Dito Ramos <a href="http:///compose?to=***@uol.com.br" target="_blank">***@uol.com.br</a> [shell-script] &lt;<a href="http:///compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt; wrote:</div>

<blockquote class="gmail_quote" style="border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div style="background-color: rgb(255, 255, 255);"><span>&nbsp;</span>

<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-msg">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-text">
<p>Boa, Itamar. Funcionou, em partes.<br>
S&oacute; que eu preciso armazenar $i para usar futuramente, entende?<br>
Na pr&aacute;tica, tenho um diret&oacute;rio com 250 arquivos .mp3. Ex:<br>
<br>
Vin&iacute;cius de Moraes - Garota de Ipanema.mp3<br>
Chico Buarque - Constru&ccedil;&atilde;o.mp3<br>
John Lennon - Imagine.mp3<br>
..... e assim por diante.<br>
<br>
Quero pegar $i do la&ccedil;o l&aacute; e renomear os arquivos pr&aacute; que fiquem assim, por exemplo:<br>
<br>
202 - Vin&iacute;cius de Moraes - Garota de Ipanema.mp3<br>
050 - hico Buarque - Constru&ccedil;&atilde;o.mp3<br>
002 - John Lennon - Imagine.mp3<br>
... e assim por diante.<br>
<br>
Por isso &eacute; importante manter o la&ccedil;o for l&aacute;, entende?<br>
<br>
Mas mesmo assim, agrade&ccedil;o.<br>
<br>
Dito</p> <hr> <div><br> <strong>De: </strong>&quot;Alfredo Casanova <a href="http:///compose?to=***@gmail.com" target="_blank">***@gmail.com</a> [shell-script]&quot; &lt;<a href="http:///compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt;<br>
<strong>Enviada: </strong>2017/05/02 11:39:12<br>
<strong>Para: </strong><a href="http:///compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a><br>
<strong>Assunto: </strong> Re: [shell-script] Imprimir sequ&ecirc;ncia de n&uacute;meros randomicamente, SEM REPETI&Ccedil;&Atilde;O<br>
&nbsp;</div>
<span>&nbsp;</span>

<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-text">&nbsp;</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-msg">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-text">
<p>&nbsp;</p>

<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-text">
<p>&nbsp;</p>

<div dir="ltr">Dito, vc pode fazer a primeira tarefa usando a seguinte constru&ccedil;&atilde;o:<br>
echo {0..500..2} <div>&nbsp;</div> <div>Isso vai imprimir os numeros de 0 a 500 com incremento de 2.</div> <div>&nbsp;</div> <div>Para &quot;embaralhar&quot; todos, eu faria:</div> <div>&nbsp;</div> <div>echo {0..500..2} | tr &#39; &#39; &#39;\n&#39; | shuf</div> </div> </div> <p>&nbsp;</p> </div> </div> </div> </div> <div style="background-color: rgb(255, 255, 255);"> <div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-mlmsg"> <div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-msg"> <div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-text"> <p>&nbsp;</p> <div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-text"> <div class="gmail_quote"> <div dir="ltr">On Tue, May 2, 2017 at 11:34 AM Dito Ramos <a href="http:///compose?to=***@uol.com.br" target="_blank">***@uol.com.br</a> [shell-script] &lt;<a href="http:///compose?to=shell-***@yahoogrupos.com.br" target="_blank">shell-***@yahoogrupos.com.br</a>&gt; wrote:</div>
</div>
</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-msg">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-text">
<p>&nbsp;</p>

<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-text">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="border-left-color: rgb(204, 204, 204);border-left-width: 1px;border-left-style: solid;">
<div style="background-color: rgb(255, 255, 255);"><span>&nbsp;</span>

<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369m_7183178578860059162ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369m_7183178578860059162ygrp-msg">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369m_7183178578860059162ygrp-text">
<p>&nbsp;</p>

<p>Mestres,<br>
Eu me aposentei do servi&ccedil;o e dei uma &quot;travada&quot; aqui em shell script.<br>
Agora estou, aos poucos, voltando a dar uma mexida.<br>
Portanto, perdoem se a quest&atilde;o &eacute; muito &quot;boba&quot;<br>
Vamos l&aacute;:<br>
Preciso imprimir de 1 a 500, somente n&uacute;meros pares.<br>
At&eacute; a&iacute;, tudo bem. Fiz assim:<br>
<br>
#!/bin/bash<br>
for ((i=1;i&lt;501;i&#43;+))<br>
do<br>
&nbsp;(( $i % 2 == 0 )) &amp;&amp; echo $i<br>
done<br>
<br>
Por&eacute;m, preciso imprimir essa sequ&ecirc;ncia randomicamente, mas sem repetir nenhum n&uacute;mero, de forma que me seja retornado os 250 n&uacute;meros da cadeia.<br>
Sei que tem a vari&aacute;vel $random. Mas n&atilde;o estou sabendo usar para este caso.<br>
Podem ajudar?<br>
<br>
Grato<br>
<br>
Dito Ramos&nbsp;<br>
&nbsp;</p>

<p>&nbsp;</p>
</div>

<div style="height: 0px;color: rgb(255, 255, 255);">&nbsp;</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580m_-772472528692901369ygrp-msg">
<div style="height: 0px;color: rgb(255, 255, 255);">&nbsp;</div>
</div>
</div>
</div>
</blockquote>
</div>

<p>&nbsp;</p>
</div>

<p>&nbsp;</p>
</div>
</div>
</div>
</div>

<div style="background-color: rgb(255, 255, 255);">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-mlmsg">
<div id="m_4673599552032884819m_-8075458350875350580ygrp-msg">
<div style="height: 0px;color: rgb(255, 255, 255);">&nbsp;</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>

<p>&nbsp;</p>
</div>
<!-- end group email -->
</p>

</div>


<!--~-|**|PrettyHtmlStart|**|-~-->
<div style="color: #fff; height: 0;">__._,_.___</div>






<div style="clear:both"> </div>

<div id="fromDMARC" style="margin-top: 10px;">
<hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
Enviado por: Dito Ramos &lt;***@uol.com.br&gt; <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
</div>
<div style="clear:both"> </div>

<table cellspacing=4px style="margin-top: 10px; margin-bottom: 10px; color: #2D50FD;">
<tbody>
<tr>
<td style="font-size: 12px; font-family: arial; font-weight: bold; padding: 7px 5px 5px;" >
<a style="text-decoration: none; color: #2D50FD" href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/messages/40126;_ylc=X3oDMTJxNWNpYmRpBF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTI2BHNlYwNmdHIEc2xrA3JwbHkEc3RpbWUDMTQ5Mzc0MDU3Nw--?act=reply&messageNum=40126">Responder através da web</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="mailto:***@uol.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD;">
</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;">
<a href="mailto:shell-***@yahoogrupos.com.br?subject=Res%3A%20RE%3A%20%5Bshell-script%5D%20Imprimir%20sequ%C3%AAncia%20de%20n%C3%BAmeros%20randomicamente%2C%20SEM%20REPETI%C3%87%C3%83O" style="text-decoration: none; color: #2D50FD">
através de email </a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/newtopic;_ylc=X3oDMTJlNmNxMDd1BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTQ5Mzc0MDU3Nw--" style="text-decoration: none; color: #2D50FD">Adicionar um novo tópico</a>
</td>
<td>&bull;</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px;color: #2D50FD;" >
<a href="https://br.groups.yahoo.com/neo/groups/shell-script/conversations/topics/40117;_ylc=X3oDMTM2aGFmMHQ5BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BG1zZ0lkAzQwMTI2BHNlYwNmdHIEc2xrA3Z0cGMEc3RpbWUDMTQ5Mzc0MDU3NwR0cGNJZAM0MDExNw--" style="text-decoration: none; color: #2D50FD;">Mensagens neste tópico</a>
(10)
</td>
</tr>
</tbody>
</table>



<!------- Start Nav Bar ------>
<!-- |**|begin egp html banner|**| -->
<!-- |**|end egp html banner|**| -->


<div id="ygrp-grfd" style="font-family: Verdana; font-size: 12px; padding: 15px 0;">

<!-- |**|begin egp html banner|**| -->

---------------------------------------------------------------------<BR>
Esta lista não admite a abordagem de outras liguagens de programação, como perl, C etc. Quem insistir em não seguir esta regra será moderado sem prévio aviso.<BR>
---------------------------------------------------------------------<BR>
Sair da lista: shell-script-***@yahoogrupos.com.br<BR>
---------------------------------------------------------------------<BR>
Esta lista é moderada de acordo com o previsto em <a href="http://www.listas-discussao.cjb.net">http://www.listas-discussao.cjb.net</a><BR>
---------------------------------------------------------------------<BR>
Servidor Newsgroup da lista: news.gmane.org<BR>
Grupo: gmane.org.user-groups.programming.shell.brazil<BR>
<BR>

<!-- |**|end egp html banner|**| -->

</div>




<!-- |**|begin egp html banner|**| -->
<div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

<span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; "><a href="https://br.groups.yahoo.com/neo/groups/shell-script/info;_ylc=X3oDMTJlZmUyNTQ2BF9TAzk3NDkwNDM3BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ5Mzc0MDU3Nw--" style="text-decoration: none;">Visite seu Grupo</a></span>

<ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
</ul>
</div>


<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
<a href="https://br.groups.yahoo.com/neo;_ylc=X3oDMTJkdGJsbmMzBF9TAzk3NDkwNDM1BGdycElkAzE5NDEzMTIEZ3Jwc3BJZAMyMTM3MTExMjU0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDkzNzQwNTc3" style="float: left;"><img src="http://l.yimg.com/ru/static/images/yg/img/email/new_logo/yahoo_groups_pt-BR_141x19.png" height="19" width="141" alt="Yahoo! Grupos" style="border: 0;"/></a>
<div style="color: #747575; float: right;"> &bull; <a href="https://info.yahoo.com/privacy/br/yahoo/groups/details.html" style="text-decoration: none;">Privacidade</a> &bull; <a href="mailto:shell-script-***@yahoogrupos.com.br?subject=Sair do grupo" style="text-decoration: none;">Sair do grupo</a> &bull; <a href="https://info.yahoo.com/legal/br/yahoo/utos/terms/" style="text-decoration: none;">Termos de uso</a> </div>
</div>
<br>

<!-- |**|end egp html banner|**| -->

</div> <!-- ygrp-msg -->


<!-- Sponsor -->
<!-- |**|begin egp html banner|**| -->
<div id="ygrp-sponsor" style="width:160px; float:right; clear:none; margin:0 0 25px 0; background: #fff;">

<!-- Start Recommendations -->
<div id="ygrp-reco">
</div>
<!-- End Recommendations -->



</div> <!-- |**|end egp html banner|**| -->

<div style="clear:both; color: #FFF; font-size:1px;">.</div>
</div>

<img src="http://geo.yahoo.com/serv?s=97490437/grpId=1941312/grpspId=2137111254/msgId=40126/stime=1493740577" width="1" height="1"> <br>

<img src="http://y.analytics.yahoo.com/fpc.pl?ywarid=515FB27823A7407E&a=10001310322279&js=no&resp=img" width="1" height="1">

<div style="color: #fff; height: 0;">__,_._,___</div>
<!--~-|**|PrettyHtmlEnd|**|-~-->

</body>

<!--~-|**|PrettyHtmlStart|**|-~-->
<head>
<style type="text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}

#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}

#ygrp-mkp #ads {
margin-bottom: 10px;
}

#ygrp-mkp .ad {
padding: 0 0;
}

#ygrp-mkp .ad p {
margin: 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: 700;
font-size: 78%;
line-height: 122%;
}

#ygrp-sponsor #ygrp-lc .ad {
margin-bottom: 10px;
padding: 0 0;
}

#actions {
font-family: Verdana;
font-size: 11px;
padding: 10px 0;
}

#activity {
background-color: #e0ecee;
float: left;
font-family: Verdana;
font-size: 10px;
padding: 10px;
}

#activity span {
font-weight: 700;
}

#activity span:first-child {
text-transform: uppercase;
}

#activity span a {
color: #5085b6;
text-decoration: none;
}

#activity span span {
color: #ff7900;
}

#activity span .underline {
text-decoration: underline;
}

.attach {
clear: both;
display: table;
font-family: Arial;
font-size: 12px;
padding: 10px 0;
width: 400px;
}

.attach div a {
text-decoration: none;
}

.attach img {
border: none;
padding-right: 5px;
}

.attach label {
display: block;
margin-bottom: 5px;
}

.attach label a {
text-decoration: none;
}

blockquote {
margin: 0 0 0 4px;
}

.bold {
font-family: Arial;
font-size: 13px;
font-weight: 700;
}

.bold a {
text-decoration: none;
}

dd.last p a {
font-family: Verdana;
font-weight: 700;
}

dd.last p span {
margin-right: 10px;
font-family: Verdana;
font-weight: 700;
}

dd.last p span.yshortcuts {
margin-right: 0;
}

div.attach-table div div a {
text-decoration: none;
}

div.attach-table {
width: 400px;
}

div.file-title a, div.file-title a:active, div.file-title a:hover, div.file-title a:visited {
text-decoration: none;
}

div.photo-title a, div.photo-title a:active, div.photo-title a:hover, div.photo-title a:visited {
text-decoration: none;
}

div#ygrp-mlmsg #ygrp-msg p a span.yshortcuts {
font-family: Verdana;
font-size: 10px;
font-weight: normal;
}

.green {
color: #628c2a;
}

.MsoNormal {
margin: 0 0 0 0;
}

o {
font-size: 0;
}

#photos div {
float: left;
width: 72px;
}

#photos div div {
border: 1px solid #666666;
height: 62px;
overflow: hidden;
width: 62px;
}

#photos div label {
color: #666666;
font-size: 10px;
overflow: hidden;
text-align: center;
white-space: nowrap;
width: 64px;
}

#reco-category {
font-size: 77%;
}

#reco-desc {
font-size: 77%;
}

.replbq {
margin: 4px;
}

#ygrp-actbar div a:first-child {
/* border-right: 0px solid #000;*/
margin-right: 2px;
padding-right: 5px;
}

#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-mlmsg #logo {
padding-bottom: 10px;
}


#ygrp-msg p a {
font-family: Verdana;
}

#ygrp-msg p#attach-count span {
color: #1E66AE;
font-weight: 700;
}

#ygrp-reco #reco-head {
color: #ff7900;
font-weight: 700;
}

#ygrp-reco {
margin-bottom: 20px;
padding: 0px;
}

#ygrp-sponsor #ov li a {
font-size: 130%;
text-decoration: none;
}

#ygrp-sponsor #ov li {
font-size: 77%;
list-style-type: square;
padding: 6px 0;
}

#ygrp-sponsor #ov ul {
margin: 0;
padding: 0 0 0 8px;
}

#ygrp-text {
font-family: Georgia;
}

#ygrp-text p {
margin: 0 0 1em 0;
}

#ygrp-text tt {
font-size: 120%;
}

#ygrp-vital ul li:last-child {
border-right: none !important;
}
-->
</style>
</head>

<!--~-|**|PrettyHtmlEnd|**|-~-->
</html>
<!-- end group email -->
Leslie Watter watter@gmail.com [shell-script]
2017-05-02 14:50:34 UTC
Permalink
Oi Ditto,

Misturei um pouco a tua solução pros numeros pares e coloquei em uma
variável, junto com a solução em [0] e saiu o seguinte:

---------------------------------------------------------------------------------------------------------------------
PARES=$(for i in `seq 2 2 501`; do echo -n "$i;"; done )

array=( $(echo "$PARES" | sed -r 's/(.[^;]*;)/ \1 /g' | tr " " "\n" | shuf
| tr -d " " ) )

for i in {1..249}; do
echo ${array[i]}
done
---------------------------------------------------------------------------------------------------------------------

Isso deve cuspir a sequencia aleatória pra vc só dos números pares.


Só pra efeito de explicação, segue a saida dos comandos

$ echo $PARES
2;4;6;8;10;12;14;16;18;20;22;24;26;28;30;32;34;36;38;40;42;44;46;48;50;52;54;56;58;60;62;64;66;68;70;72;74;76;78;80;82;84;86;88;90;92;94;96;98;100;102;104;106;108;110;112;114;116;118;120;122;124;126;128;130;132;134;136;138;140;142;144;146;148;150;152;154;156;158;160;162;164;166;168;170;172;174;176;178;180;182;184;186;188;190;192;194;196;198;200;202;204;206;208;210;212;214;216;218;220;222;224;226;228;230;232;234;236;238;240;242;244;246;248;250;252;254;256;258;260;262;264;266;268;270;272;274;276;278;280;282;284;286;288;290;292;294;296;298;300;302;304;306;308;310;312;314;316;318;320;322;324;326;328;330;332;334;336;338;340;342;344;346;348;350;352;354;356;358;360;362;364;366;368;370;372;374;376;378;380;382;384;386;388;390;392;394;396;398;400;402;404;406;408;410;412;414;416;418;420;422;424;426;428;430;432;434;436;438;440;442;444;446;448;450;452;454;456;458;460;462;464;466;468;470;472;474;476;478;480;482;484;486;488;490;492;494;496;498;500;


$ for i in {1..249}; do echo -n ${array[i]} " __ "; done
250; __ 460; __ 328; __ 406; __ 212; __ 136; __ 108; __ 364; __ 86;
__ 24; __ 312; __ 496; __ 104; __ 432; __ 268; __ 214; __ 8; __
278; __ 142; __ 352; __ 34; __ 164; __ 204; __ 186; __ 38; __ 466;
__ 390; __ 302; __ 18; __ 64; __ 292; __ 244; __ 400; __ 486; __
74; __ 230; __ 122; __ 456; __ 370; __ 338; __ 156; __ 152; __ 210;
__ 500; __ 402; __ 252; __ 76; __ 470; __ 326; __ 240; __ 438; __
314; __ 360; __ 260; __ 300; __ 290; __ 36; __ 294; __ 418; __ 376;
__ 372; __ 232; __ 42; __ 306; __ 478; __ 350; __ 394; __ 140; __
208; __ 238; __ 22; __ 288; __ 380; __ 482; __ 348; __ 386; __ 20;
__ 446; __ 480; __ 158; __ 440; __ 56; __ 94; __ 12; __ 474; __
450; __ 178; __ 410; __ 488; __ 384; __ 344; __ 130; __ 72; __ 422;
__ 58; __ 264; __ 434; __ 420; __ 320; __ 40; __ 266; __ 258; __
32; __ 226; __ 150; __ 256; __ 222; __ 448; __ 356; __ 6; __ 144;
__ 180; __ 458; __ 126; __ 138; __ 414; __ 346; __ 196; __ 462; __
368; __ 298; __ 174; __ 228; __ 354; __ 316; __ 276; __ 114; __ 52;
__ 468; __ 444; __ 202; __ 62; __ 162; __ 272; __ 194; __ 296; __
216; __ 50; __ 168; __ 284; __ 154; __ 408; __ 206; __ 358; __ 366;
__ 396; __ 442; __ 412; __ 334; __ 242; __ 224; __ 172; __ 332; __
220; __ 128; __ 112; __ 280; __ 30; __ 176; __ 46; __ 340; __ 148;
__ 484; __ 68; __ 200; __ 14; __ 378; __ 424; __ 274; __ 476; __
218; __ 182; __ 330; __ 78; __ 84; __ 392; __ 188; __ 48; __ 336;
__ 10; __ 342; __ 28; __ 70; __ 134; __ 96; __ 198; __ 106; __
262; __ 184; __ 374; __ 192; __ 494; __ 132; __ 102; __ 310; __
430; __ 426; __ 388; __ 308; __ 26; __ 318; __ 170; __ 270; __ 324;
__ 44; __ 80; __ 454; __ 2; __ 248; __ 236; __ 404; __ 4; __ 146;
__ 90; __ 124; __ 100; __ 92; __ 166; __ 118; __ 428; __ 98; __
436; __ 16; __ 60; __ 116; __ 490; __ 286; __ 464; __ 88; __ 120;
__ 322; __ 472; __ 66; __ 160; __ 498; __ 282; __ 54; __ 452; __
416; __ 234; __ 82; __ 110; __ 362; __ 382; __ 492; __ 304; __ 190;
__ 246; __ 398; __ __


[]s

LEslie




[0] -
http://stackoverflow.com/questions/5533569/simple-method-to-shuffle-the-elements-of-an-array-in-bash-shell
Post by Dito Ramos ***@uol.com.br [shell-script]
Mestres,
Eu me aposentei do serviço e dei uma "travada" aqui em shell script.
Agora estou, aos poucos, voltando a dar uma mexida.
Portanto, perdoem se a questão é muito "boba"
Preciso imprimir de 1 a 500, somente números pares.
#!/bin/bash
for ((i=1;i<501;i++))
do
(( $i % 2 == 0 )) && echo $i
done
Porém, preciso imprimir essa sequência randomicamente, mas sem repetir
nenhum número, de forma que me seja retornado os 250 números da cadeia.
Sei que tem a variável $random. Mas não estou sabendo usar para este caso.
Podem ajudar?
Grato
Dito Ramos
--
Leslie H. Watter
Continue reading on narkive:
Loading...