![]() |
|
|
google unix.com
|
|||||||
| Fóruns | Registar | Fórum Regimento | Ligações | Álbuns | FAQ | Lista deputados | Calendário | Pesquisa | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
Linkback | Thread Tools | Pesquisar este Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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.. |
|
|||||
|
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
|
![]() |
| Marcadores |
| Thread Tools | Pesquisar este Thread |
| Display Modes | Esta taxa Thread |
|
|