Gamer.Site Web Search

Search results

  1. Results From The WOW.Com Content Network
  2. BASH base conversion from decimal to hex

    unix.stackexchange.com/questions/191205

    With supported bases ranging from 2 to some number required by POSIX to be at least as high as 99. For bases greater than 16, digits greater than 9 are represented as space-separated 0-padded decimal numbers. $ echo 'obase=30; 123456' | bc 04 17 05 06 Or same with dc (bc used to be (and still is on some systems) a wrapper around dc):

  3. Binary to hexadecimal and decimal in a shell script

    unix.stackexchange.com/questions/65280

    So if your ibase is 2, then if you set your obase to 10, it won't do anything, as 10 in binary is 2. Hence you need to use hexadecimal notation. So binary to decimal would be (watch that obase is A) Binary to decimal: $> echo 'ibase=2;obase=A;11110001011010'|bc. 15450.

  4. I have a need to convert a list of decimal values in a text file into hex format, so for example test.txt might contain: 131072 196608 262144 327680 393216 ... the output should be list of hex values (hex 8 digit, with leading zeroes): 00020000 00030000 00040000 ... the output is printed into the text file.

  5. I want to convert a decimal number to hexadecimal number. I used the command : printf '%X\n' 053698180 This command is working perfectly fine on Linux server.

  6. Convert hexadecimal to binary on Linux CLI

    unix.stackexchange.com/questions/279505

    Okay, in the light of what you have said and what I understood, I have a couple of suggestions to you. The first one, converts each hex line into a new binary line and puts a line break at the end of each line. here is that solution: len=${#line} binline="". index=1. while [ ${index} -le ${len} ] do.

  7. Convert a value into a "Binary Number" in a shell script

    unix.stackexchange.com/questions/223338

    This question: Binary to hexadecimal and decimal in a shell script Asks how to convert FROM binary, not TO a binary number. The answers there deal either with binary byte (as opposed to binary number, i.e.: a base-2 number) using xxd, or some other external tool. So, no, this question is not a duplicate of that.

  8. Bash arithmetic outputs result in decimal - Unix & Linux Stack...

    unix.stackexchange.com/questions/616215/bash-arithmetic-outputs-result-in-decimal

    POSIX requires at least decimal, octal and hexadecimal constants to be recognised using the 123, 0123 and 0x123 syntax respectively. Some shells like mksh or zsh don't recognise 0123 as octal by default as doing it gets in the way more often than it is useful (like when dealing with 0-padded numbers), only when some POSIX compatibility mode is ...

  9. How to add two hexadecimal numbers in a bash script

    unix.stackexchange.com/questions/415077

    I want to add two hexadecimal variables in a bash script. I want them to start as hex and end in hex, not decimal. What I've come up with so far is a bit of a round about hack. Is there a bette...

  10. awk will silently convert strings to numbers. Which number? The number you get by taking the initial decimal digits of the string (this may be just "", if the string is empty or doesn't begin with any decimal digits, as is the case with "A") and converting them to a number. "" gets converted to 0. So all of these would be converted to 0: "0 ...

  11. Modify and Replace $1 (awk) or \1 (sed) Values from Decimal to...

    unix.stackexchange.com/questions/685065/modify-and-replace-1-awk-or-1-sed...

    Is it possible to Modify and Replace $1 (awk) or \1 (sed) Values from Decimal to Hexadecimal Globally in a String? It is possible that the string may contain any decimal value, which needs to be modified and replaced with its hexadecimal equivalent. awk example: