Sponsored Content
Top Forums UNIX for Advanced & Expert Users Converting Binary decimal coded values to Ascii Values Post 302180448 by gaur.deepti on Monday 31st of March 2008 08:46:29 AM
Old 03-31-2008
Hi ,

I have tried the below things but i am getting the output as all numbers


dd if=inputfile of=test.dat ibs=512 cbs=0 conv=ascii
dd conv=ascii | od -c inputfile > test.dat

i am getting the below values

0000140 4149 4c4c 474d 412e 3946 4939 4942 302e
0000160 3630 3133 3930 0333 4500 5888 8e82 eeee
0000200 eeee eeee eeee 0299 0075 0063 0000 3208
0000220 8888 ee73 eeee 0eee 0e0e 300e 0e03 e863

the above values contains varchar and date columns which i am not able to see

pls suggest any other way

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
dd(1)							      General Commands Manual							     dd(1)

Name
       dd - copy and convert data

Syntax
       dd [option = value...]

Description
       The  command copies an input file to an output with any requested conversions.  The command is especially suited to I/O on the raw physical
       devices because it allows reading and writing in arbitrary record sizes.

       After completion, reports the number of whole and partial input and output blocks.

       This utility supports EOT handling which allows the use of multiple media.  The utility prompts for the next volume when it encounters  the
       end of the current volume.

Options
       Where  sizes (n) are given for an option, the number may end with k for kilobytes (1024 bytes), b for blocks (512 bytes), or w for words (2
       bytes).	Also, two numbers may be separated by the character x to indicate a product.

       if=name		   Input file name.  The standard input is the default.

       of=name		   Output file name.  The standard output is the default.

       ibs=n		   Input block size, n bytes. The default is 512 bytes.  Some devices do not support greater than 65,535 bytes.

       obs=n		   Output block size, n bytes.	The default is 512 bytes.  Some devices do not support greater than 65,535 bytes.

       bs=n		   Set both input and output block size to n bytes, superseding ibs and obs.  Also, if bs is specified, the copy  is  more
			   efficient, since no blocking conversion is necessary.

       cbs=n		   Conversion buffer size, n bytes.  Use only if ascii, unblock, ebcdic, ibm, or block conversion is specified.  For ascii
			   and unblock, n characters are placed into the conversion buffer, any specified  character  mapping  is  done,  trailing
			   blanks are trimmed and new line added before sending the line to the output.  For ebcdic, ibm, or block, characters are
			   read into the conversion buffer, and blanks added to make an output record of size n bytes.

       skip=n		   Skip n input records before starting to copy.

       files=n		   Copy n input files before terminating.  This option is useful only when the input is a magnetic tape or similar device.

       seek=n		   Seek n records from beginning of output file before copying.

       rbuf=n		   Use n buffers for reading from those raw devices that support n-buffered I/O.  (See Section 4 to check whether  a  spe-
			   cific  device  supports  n-buffered	I/O.)	All n reads are started and each read must complete before the data can be
			   used.  This allows an n-buffered read-ahead on supported raw devices.

			   A default of eight read buffers are used if the read device supports n-buffered I/O and the write device does not.

			   The rbuf option cannot be used with the wbuf option.

       wbuf=n		   Use n buffers for writing from those raw devices that support n-buffered I/O.  (See Section 4 to check whether  a  spe-
			   cific  device  supports  n-buffered	I/O.)  Each write is started but not known to be complete until all n buffers have
			   been used.  (This allows an n-buffered write-behind on supported raw devices).

			   A default of eight write buffers are used if the write device supports n-buffered I/O.

			   The wbuf option cannot be used with the rbuf option.

       count=n		   Copy only n input records.

       conv=ascii	   Convert EBCDIC to ASCII.

       conv=ebcdic	   Convert ASCII to EBCDIC.

       conv=ibm 	   Slightly different map of ASCII to EBCDIC (see RESTRICTIONS).

       conv=block	   Convert variable length records to fixed length.

       conv=unblock	   Convert fixed length records to variable length.

       conv=lcase	   Map alphabetics to lower case.

       conv=ucase	   Map alphabetics to upper case.

       conv=swab	   Swap every pair of bytes.

       conv=noerror	   Do not stop processing on an error.

       conv=sync	   Pad every input record to ibs.

       conv=nomulti	   Disable multiple tape volumes.

       conv=sparse	   Create a sparse output file.

       conv=... , ...	   Include several arguments for the conv option, separated by commas (see example below).

Examples
       The following example shows how to read an EBCDIC tape blocked ten 80-byte EBCDIC card images per record into the ASCII file x:
       dd if=/dev/rmt0h of=x ibs=800 cbs=80 conv=ascii,lcase

       Note the use of raw magtape.  As noted in the DESCRIPTION, the command is especially suited to I/O on the raw physical devices  because	it
       allows reading and writing in arbitrary record sizes.

Restrictions
       The ASCII/EBCDIC conversion tables are taken from the 256-character standard in the Communications of the ACM, (R)November, 1968.

       The ibm conversion corresponds to certain IBM print train conventions.

       One must specify ``conv=noerror,sync'' when copying raw disks with bad sectors to ensure that dd stays synchronized.
       On  SCSI  tape devices when reading a multi-volume tape set the command will exit normally upon hitting EOT on any volume rather than auto-
       matically unloading the volume and prompting for the next volume as is normal. The user should load the next volume and issue  the  command
       anew.

Diagnostics
       f+p records in(out): numbers of full and partial records read(written)

See Also
       cp(1), tr(1), nbuf(4)

																	     dd(1)
All times are GMT -4. The time now is 03:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy