[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] print com awk
From: |
MrBiTs |
Subject: |
Re: [shell-script] print com awk |
Date: |
Thu, 06 Oct 2005 12:32:39 -0300 |
User-agent: |
Mozilla Thunderbird 1.0.6 (X11/20050716) |
> Preciso imprimir somente os dois primeiros dígitos de um segundo campo
> de um arquivo. Como fazer isto com o awk, conforme exeplo abaixo??:
>
> cat arq.txt
>
> tempest 99979798790767 15
>
>
> a saída precisa ser:
>
> tempest 99 15
>
Tem que ser obrigatóriamente com awk ?
Digamos que $NUMERO seja a variável que contem o 9997978790767. Algo assim:
$ echo ${NUMERO:0:2}
99
não resolveria ?
--
"There is still more Unix-nature in one
line of shell script than there is in
ten thousand lines of C"
Master Foo - Hsh-bng Province - 530 BC
"Programar Shell Script é a coisa mais
gostosa que você pode fazer vestido"
Mestre J. C. Neves - 10/08/2005
\\|||//
(.) (.)
----ooOO--( )--OOoo-----
MrBiTs
http://www.mrbits.com.br
address@hidden
------------------------