I think you need to write:
for(inx in arrERRORS){
printf("---- %3d: %s\n",arrCOUNT[arrERRORS[inx]],
arrERRORS [inx])| "sort -f -k2"
}
This will pipe your print through sort -- use -k(n)
to sort on the right position (see man sort).
jmagave
I'm not shure if nawk supports octal/hexa representation of
ascii codes. If so, I prefer:
echo |
nawk '{for (i=0; i < 10; i++){
print "CA\047s jose"
}'
Where \047 is octal for 39 - ascii code of '.
PS: I changed the for loop var :-)
jmagave
I should know *NIX had something, 'cause this sound
pretty mundane task. I thought join could work, but it requires common fields. Alas, [code]paste[code] does the job (it even works on my cygwin).
I do read man pages... but someone must tell you
they exist for the needed task. A star to...
Hi all,
A bit off-topic, but...
I am brazilian, and I wish the best for my
american friends on this 4th July.
May God bless your nation (provided Bush don't
mess up things too much :)
Strength and Honor!
Jayr Magave
Hi all,
1) I think CaKiwi`s solution is fine (it saves one function call which slows performance).
I would change it to:
AWK '{sub(/[0-9]+/,"",$3);
print $3;
}'
We removed the caret "^" which NEGATES the regex range. I think Murugs wants TEXT not...
The requirement said:
" ...each line that *may* have 1 or 2 leading zeroes.."
To me *may* means may or may not.
So your regex /0[1-9]+/ will match positive to "1023", and
the index() will miss the "1" before the "0".
I guess /^0[1-9]+/ would correct...
Well, I would prefer:
AWK 'BEGIN{
OFS=FS=","
}
{$3 = $3 + 0;
print FILENAME,$0;
}
This will convert field $3 to Number
and get rid of ALL leading Zeroes.
Furthermore, IMHO your solution may
mess with Zeroes INSIDE $3
Jayr Magave
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.