Hi,
please tell me how to convert hex number to decimal
000000E7
000000000002640D
0000000000025B16
and seconds to minutes, hours, days, months, years
bytes to kbytes, mbytes , gbytes
read the following examples
while read a b
do
printf "%5d %5d\n" "0x$a" "0x$b"
done < "$FILE"... (15 Replies)
Please Help Me! about the problem down under.
I have 2 files with nearly the same characteristics, I have to convert one to the other format or the other format to one's format. I want to write it with awk.
The first file contain lines like this:
300000001#A#Y#Y#Y#Y
The other file contain... (4 Replies)
Dear All PROs
Thanks in advance
need a shell for Decimal to hex conversion
input file (decimal values)
65,5,48,66,133,131,118,47
65,5,48,66,133,131,83,63
.
.
desire output should be (Hex value)... (11 Replies)
I am writing a bash script to do some parsing on a log and I am running into a problem when it comes to converting only certain sections of the file from hex to ascii or hex to decimal.
Data Example:
The hex values after Hardware and SW Version I need to convert from Hex to ASCII and the... (16 Replies)
I have 32 bit value in hex that I want to separate into fields and then convert the fields into decimal values.
Input file has 2 words of 32 bit hex values:
000001ac
ca85210e
Output both words separated into individual bit fields:
ca85210e: f1(31:9), f2(8:0)
f7c392ac: f1(31:14),... (2 Replies)
The file contains code like the below and need to convert each one into a decimal
00 00 00 04 17 03 06 01
So the output should come as
0 0 0 4 23 3 6 1 (24 Replies)
How to convert decimal value to hex and than take 1st digits as variable
sample data
84844294,5,6
51291736,2,3
84844294,5,6
51291736,2,3
i can use {printf "%x,%d\n",$1,$2} but than i want to filter base on 1st hex digit 1st recrd (1 Reply)
Hi ,
seq can be 0...128
int windex = seq / 8;
int bindex = seq % 8;
unsigned char bitvalue = '\x01' << (7-bindex) ;
bpv.bitmapvalue = bitvalue;
This is the part of a program to convert decimal to bitmap value of hexadecimal.
I want this to change to convert only to... (1 Reply)
Discussion started by: greenworld123
1 Replies
LEARN ABOUT MOJAVE
core5.18
CORE(3pm) Perl Programmers Reference Guide CORE(3pm)NAME
CORE - Namespace for Perl's core routines
SYNOPSIS
BEGIN {
*CORE::GLOBAL::hex = sub { 1; };
}
print hex("0x50"),"
"; # prints 1
print CORE::hex("0x50"),"
"; # prints 80
CORE::say "yes"; # prints yes
BEGIN { *shove = &CORE::push; }
shove @array, 1,2,3; # pushes on to @array
DESCRIPTION
The "CORE" namespace gives access to the original built-in functions of Perl. The "CORE" package is built into Perl, and therefore you do
not need to use or require a hypothetical "CORE" module prior to accessing routines in this namespace.
A list of the built-in functions in Perl can be found in perlfunc.
For all Perl keywords, a "CORE::" prefix will force the built-in function to be used, even if it has been overridden or would normally
require the feature pragma. Despite appearances, this has nothing to do with the CORE package, but is part of Perl's syntax.
For many Perl functions, the CORE package contains real subroutines. This feature is new in Perl 5.16. You can take references to these
and make aliases. However, some can only be called as barewords; i.e., you cannot use ampersand syntax (&foo) or call them through
references. See the "shove" example above. These subroutines exist for all keywords except the following:
"__DATA__", "__END__", "and", "cmp", "default", "do", "dump", "else", "elsif", "eq", "eval", "for", "foreach", "format", "ge", "given",
"goto", "grep", "gt", "if", "last", "le", "local", "lt", "m", "map", "my", "ne", "next", "no", "or", "our", "package", "print", "printf",
"q", "qq", "qr", "qw", "qx", "redo", "require", "return", "s", "say", "sort", "state", "sub", "tr", "unless", "until", "use", "when",
"while", "x", "xor", "y"
Calling with ampersand syntax and through references does not work for the following functions, as they have special syntax that cannot
always be translated into a simple list (e.g., "eof" vs "eof()"):
"chdir", "chomp", "chop", "defined", "delete", "each", "eof", "exec", "exists", "keys", "lstat", "pop", "push", "shift", "splice", "split",
"stat", "system", "truncate", "unlink", "unshift", "values"
OVERRIDING CORE FUNCTIONS
To override a Perl built-in routine with your own version, you need to import it at compile-time. This can be conveniently achieved with
the "subs" pragma. This will affect only the package in which you've imported the said subroutine:
use subs 'chdir';
sub chdir { ... }
chdir $somewhere;
To override a built-in globally (that is, in all namespaces), you need to import your function into the "CORE::GLOBAL" pseudo-namespace at
compile time:
BEGIN {
*CORE::GLOBAL::hex = sub {
# ... your code here
};
}
The new routine will be called whenever a built-in function is called without a qualifying package:
print hex("0x50"),"
"; # prints 1
In both cases, if you want access to the original, unaltered routine, use the "CORE::" prefix:
print CORE::hex("0x50"),"
"; # prints 80
AUTHOR
This documentation provided by Tels <nospam-abuse@bloodgate.com> 2007.
SEE ALSO
perlsub, perlfunc.
perl v5.18.2 2013-11-04 CORE(3pm)