Awk cheatsheet: Difference between revisions
From Lolly's Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
[[Kategorie:AWK|Cheatsheet]] | |||
==Functions== | ==Functions== | ||
Line 12: | Line 13: | ||
} | } | ||
</source> | </source> | ||
Revision as of 11:37, 14 October 2016
Functions
Binary to decimal
function b2d(bin){
len=length(bin);
for(i=1;i<=len;i++){
dec+=substr(bin,i,1)*2^(len-i);
}
return dec;
}