[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Awk underlighed



En af mine kolleger ville bruge awk til at gange et hexadecimalt
input-tal med 4, og skrive resultatet ud som et fire-cifret
hex-tal.

Efter nogle forsøg kom jeg frem til 

   echo "0xf" | awk '{ printf ("%04X\n", $1*4) }'

hvilket virkede fint på min rød-hætte maskine med gawk 3.0.6.

Det underlige er nu, at en anden maskine har gawk 3.1.0 installeret.
Og her virker det ikke - hexadecimalt input giver altid resultat 0.
Decimalt input virker fint.

Nogen awk-eksperter der kan forklare om det er en fejl i gawk 3.1.0,
eller der er en god grund til at den gør som den gør ?


Henrik
-- 
Henrik Storner      | "ATA100 is another testimony to the fact that 
<sslug@sslug> |  pigs can be made to fly given sufficient thrust"
                    | 
                    |          Linux kernel hacker Alan Cox, on IDE drives


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 19:23 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *