The UNIX and Linux Forums  

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



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

Mais UNIX e Linux Fórum Tópicos Você pode achar Helpfull
Fio Thread Starter Fórum Respostas Última postagem
pls me ajudar no script lakshmananindia UNIX & avançada para usuários experientes 3 09-04-2007 09:42
diferença entre AIX e Unix shell scripts shell scripts. haroonec Programação Shell Script e 2 04-12-2006 09:12
scripting guru da pls me ajudar com scripting no AIX thatiprashant Programação Shell Script e 1 01-20-2006 07:58
Novo para scripting sdrtaz Programação Shell Script e 2 03-18-2005 03:22
HELP! Need HELP scripting! adawg1283 Programação Shell Script e 7 09-29-2004 04:48

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
Linkback Thread Tools Pesquisar este Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-21-2009
ulemsee ulemsee is offline
Usuário
  
 

Join Date: Apr 2009
Posts: 6
Scripts através awk

Oi,
Estou tentando entender o que está acontecendo aqui, de novo para o script: Eu tenho um par dessas, mas se eu soubesse o que estava acontecendo em uma posso descobrir o resto:

Código:
awk '/rpc-100083/ { $2 = "enable -r" }
$3 ~ /.NOS99dtlogin/ { $t = $2; $2 = $3; $3 = $t }
{ print }' /var/svc/profile/upgrade \
>/var/svc/profile/upgrade.new
mv /var/svc/profile/upgrade.new /var/svc/profile/upgrade

Obrigado.

Última edição por vgersh99; em 04/21/2009 12:13..
  #2 (permalink)  
Old 04-21-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderador
  
 

Join Date: Feb 2005
Localização: Boston, MA
Mensagens: 5.122
Em primeiro lugar, use o BB code tags quando postar código / dados amostras.
Código:
awk '
# if there's a "rpc-100083" pattern found anywhere on a current line, assign a 
# second field ($2) a string "enable -r"
/rpc-100083/ { $2 = "enable -r" }

# if a THRIRD field ($3) contains a pattern ".NOS99dtlogin", then swap the
# values in the SEND and the THIRD fields. Most likely you meant "t" and
# not "$t" variable as a temp place holder.
$3 ~ /.NOS99dtlogin/ { t = $2; $2 = $3; $3 = t }

# print the current record/line
{ print }' /var/svc/profile/upgrade \
>/var/svc/profile/upgrade.new
# Above: output the result to "upgrade.new" file

# move "upgrade.new" to "upgrade"
mv /var/svc/profile/upgrade.new /var/svc/profile/upgrade
  #3 (permalink)  
Old 04-21-2009
ulemsee ulemsee is offline
Usuário
  
 

Join Date: Apr 2009
Posts: 6
Observou.
Ok, basicamente, o que está sendo alcançado aqui, por exemplo, como é que isto ajude a colocar as medidas de segurança no Solaris?
Closed Thread

Marcadores

Thread Tools Pesquisar este Thread
Pesquisar este Thread:

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

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

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




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


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

Content Relevant URLs por vBSEO 3.2.0