Sponsored Content
Top Forums UNIX for Advanced & Expert Users Converting Binary decimal coded values to Ascii Values Post 302179593 by gaur.deepti on Friday 28th of March 2008 05:47:26 AM
Old 03-28-2008
Converting Binary decimal coded values to Ascii Values

Hi All,

Is there any command which can convert binary decimal coded values to ascii values...

i have bcd values like below

оооооооооооо0о-- -v -

Pls suggest a way to convert this.

Thanks,
Deepti.Gaur
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix script for converting a decimal to binary

Could anybody please help me in writing a script in unix for converting a decimal number to binary number. (3 Replies)
Discussion started by: softy
3 Replies

2. UNIX for Advanced & Expert Users

Converting ASCII to Binary mode

Dear All, Business Users are transfering ( FTP ) a CSV file into the IBM AIX box with transfer mode as ASCII. But I want to convert the CSV file from ASCII mode into binary mode, as my script expects file in binary mode. Is it possible to do through Unix commands? Thanks in Advance, RK (1 Reply)
Discussion started by: srajeshmca
1 Replies

3. Shell Programming and Scripting

convert ascii values into ascii characters

Hi gurus, I have a file in unix with ascii values. I need to convert all the ascii values in the file to ascii characters. File contains nearly 20000 records with ascii values. (10 Replies)
Discussion started by: sandeeppvk
10 Replies

4. UNIX for Dummies Questions & Answers

Decimal to BCD (Binary Coded Decimal)

Anybody please help me... Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary Coded Decimal) representation. Also, draw its Flow Chart. This is a unix qn... plz post algorithm for that :confused: (1 Reply)
Discussion started by: caramba
1 Replies

5. Homework & Coursework Questions

Decimal to BCD (Binary Coded Decimal)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary... (2 Replies)
Discussion started by: caramba
2 Replies

6. Shell Programming and Scripting

Converting hex to ascii/decimal

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)
Discussion started by: Shiftkey
16 Replies

7. Shell Programming and Scripting

Converting odd values to even values(or vice-versa) located in a column

Hello All, I have a below data in a .csv file where all rows where col1 is A, col2 is odd numbers, similarly even numbers for all rows where col1 is B. Note that my data has some other columns(not shown here) too (around 100) after col2. Tool,Data A,1 A,3 A,5 .... so on B,2 B,4 .... ... (4 Replies)
Discussion started by: ks_reddy
4 Replies

8. Shell Programming and Scripting

Converting a binary file to ascii and vice versa?

Hi All, I have a binary file which is being exported from a Database, and i need to convert that to ASCII format. How can i achieve that? And this solution should work for any file which is given to us; means they will give different files from different tables. Thanks in advance. (8 Replies)
Discussion started by: baranisachin
8 Replies

9. Shell Programming and Scripting

awk file to read values from Db2 table replacing hard coded values

Hi, I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below... if (start_new_rec=="true"){ exclude_user="false"; user=toupper($6); match(user, "XXXXX."); if (RSTART ==2 ) { ... (9 Replies)
Discussion started by: asandy1234
9 Replies
BINDEC(3)								 1								 BINDEC(3)

bindec - Binary to decimal

SYNOPSIS
number bindec (string $binary_string) DESCRIPTION
Returns the decimal equivalent of the binary number represented by the $binary_string argument. bindec(3) converts a binary number to an integer or, if needed for size reasons, float. bindec(3) interprets all $binary_string values as unsigned integers. This is because bindec(3) sees the most significant bit as another order of magnitude rather than as the sign bit. PARAMETERS
o $binary_string - The binary string to convert Warning The parameter must be a string. Using other data types will produce unexpected results. RETURN VALUES
The decimal value of $binary_string EXAMPLES
Example #1 bindec(3) example <?php echo bindec('110011') . " "; echo bindec('000110011') . " "; echo bindec('111'); ?> The above example will output: 51 51 7 Example #2 bindec(3) interprets input as unsigned integers <?php /* * The lesson from this example is in the output * rather than the PHP code itself. */ $magnitude_lower = pow(2, (PHP_INT_SIZE * 8) - 2); p($magnitude_lower - 1); p($magnitude_lower, 'See the rollover? Watch it next time around...'); p(PHP_INT_MAX, 'PHP_INT_MAX'); p(~PHP_INT_MAX, 'interpreted to be one more than PHP_INT_MAX'); if (PHP_INT_SIZE == 4) { $note = 'interpreted to be the largest unsigned integer'; } else { $note = 'interpreted to be the largest unsigned integer (18446744073709551615) but skewed by float precision'; } p(-1, $note); function p($input, $note = '') { echo "input: $input "; $format = '%0' . (PHP_INT_SIZE * 8) . 'b'; $bin = sprintf($format, $input); echo "binary: $bin "; ini_set('precision', 20); // For readability on 64 bit boxes. $dec = bindec($bin); echo 'bindec(): ' . $dec . " "; if ($note) { echo "NOTE: $note "; } echo " "; } ?> Output of the above example on 32 bit machines: input: 1073741823 binary: 00111111111111111111111111111111 bindec(): 1073741823 input: 1073741824 binary: 01000000000000000000000000000000 bindec(): 1073741824 NOTE: See the rollover? Watch it next time around... input: 2147483647 binary: 01111111111111111111111111111111 bindec(): 2147483647 NOTE: PHP_INT_MAX input: -2147483648 binary: 10000000000000000000000000000000 bindec(): 2147483648 NOTE: interpreted to be one more than PHP_INT_MAX input: -1 binary: 11111111111111111111111111111111 bindec(): 4294967295 NOTE: interpreted to be the largest unsigned integer Output of the above example on 64 bit machines: input: 4611686018427387903 binary: 0011111111111111111111111111111111111111111111111111111111111111 bindec(): 4611686018427387903 input: 4611686018427387904 binary: 0100000000000000000000000000000000000000000000000000000000000000 bindec(): 4611686018427387904 NOTE: See the rollover? Watch it next time around... input: 9223372036854775807 binary: 0111111111111111111111111111111111111111111111111111111111111111 bindec(): 9223372036854775807 NOTE: PHP_INT_MAX input: -9223372036854775808 binary: 1000000000000000000000000000000000000000000000000000000000000000 bindec(): 9223372036854775808 NOTE: interpreted to be one more than PHP_INT_MAX input: -1 binary: 1111111111111111111111111111111111111111111111111111111111111111 bindec(): 18446744073709551616 NOTE: interpreted to be the largest unsigned integer (18446744073709551615) but skewed by float precision NOTES
Note The function can convert numbers that are too large to fit into the platforms integer type, larger values are returned as float in that case. SEE ALSO
decbin(3), octdec(3), hexdec(3), base_convert(3). PHP Documentation Group BINDEC(3)
All times are GMT -4. The time now is 09:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy