Sponsored Content
Top Forums Shell Programming and Scripting Converting a binary file to ascii and vice versa? Post 302859409 by Scott on Thursday 3rd of October 2013 04:42:26 AM
Old 10-03-2013
You never mentioned anything about a ~ delimiter!

Run file filename against the file. What does it say?

And what exactly do you want to do once you've "converted" it to ASCII, before you convert it back again?

Without seeing a sample of the file, and with your description and requirement being as vague as they are, I would have no idea what to suggest here.
 

10 More Discussions You Might Find Interesting

1. Programming

binary to string conversion and vice versa

please let me know that in unix using c programming language we can do binary to string conversion and vice versa using ltoa and atol but how can we do it in c++ programming language. thank you in advance. (3 Replies)
Discussion started by: kinnaree
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

Pdf to text conversion and vice versa

Hi, I have a pdf file. i want to convert it to text file and do some work on it and later want to convert it back to pdf. Can this be done via unix? or Is there a way unix can directly work on PDF file? (2 Replies)
Discussion started by: saltysumi
2 Replies

4. UNIX for Dummies Questions & Answers

Appending from a file to a script and vice versa

Hi, I am new to Unix and discovered this example problem online that I believe will help my learning: Run the command's below env >> xx env >> xx env >> xx env >> xx env >> xx You will now have a file called XX with the env redirected into it 5 times Create a script named... (2 Replies)
Discussion started by: Jimmy_c
2 Replies

5. Shell Programming and Scripting

Uppercase to lowercase and vice versa

shell script to convert file names from UPPERCASE to lowercase file names or vice versa in linux anybody please help me out!!!! (5 Replies)
Discussion started by: jacky29
5 Replies

6. Ubuntu

What is the advantage of ubuntu over vista and vice versa?

i am thinking of replacing my vista with ubuntu. Questions: 1) what will be the advantages and disadvantages of using ubuntu instead of vista? 2) what will be the setbacks of replacing my vista? 3) how hard is it to cope up with the new OS? what must i learn to utilize ubuntu? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

7. Shell Programming and Scripting

Converting from Centigrade to Fahrenheit and vice versa.

I need to write a script that will take the input from a file and convert the number from centigrade to fahrenheit and vice versa. This is what I have but it doesn't seem to be correct. Also the data file has 11 numbers inside of it and the output needs to be listed as so: Fahrenheit Temperature... (18 Replies)
Discussion started by: N1ckNak
18 Replies

8. UNIX for Dummies Questions & Answers

How to ping from Windows to Solaris 10 and vice versa?

Hi all, I installed Oracle virtual box 4.1.8 on my desktop. I installed Windows 2008 server R2 as one instance and Solaris 10 as another instance. When am trying to ping from Windows to solaris and vice-versa, ping not working. windows IP : 10.1.47.24 Solaris IP : 10.1.47.25 netstat... (2 Replies)
Discussion started by: kjks
2 Replies

9. 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

10. UNIX for Dummies Questions & Answers

Command for Host Name to IP Address or Vice Versa

Hi, In unix or linux is there any command exist to identify Host Name to IP Address or Vice Versa? Thanks in advance (6 Replies)
Discussion started by: nag_sathi
6 Replies
TYPERULES(5)							File Formats Manual						      TYPERULES(5)

NAME
typerules - HylaFAX file type identification and conversion rules DESCRIPTION
Only three types of files are accepted by the HylaFAX server for transmission as facsimile: POSTSCRIPT(R) files, PDF files, and TIFF Class F (bilevel Group 3-encoded) files. All other types of files must be converted to one of these three formats. The facsimile submission program applies a set of rules against the contents of each input file to identify the file's type and to figure out how to convert the file to a format that is suitable for transmission. These rules are stored in the file /etc/hylafax/typerules, an ASCII file that is pat- terned after the /etc/magic file used by the System V file(1) program. However, there are significant differences, noted below. Type rules work by matching data patterns in a file; typically patterns that appear in the first few bytes of the file (i.e. magic num- bers). There are two types of rules, primary rules and secondary rules. Secondary rules specify additional rules to apply after a primary rule has been matched. When secondary rules are used, rule scanning continues up to the next primary type rule in the file. Each rule consists of a set of whitespace-separated fields: offset datatype match result command If an line is terminated wth a backslash character, the entry is continued on the next line with any leading whitespace characters com- pressed to a single space. Comments are marked with the ``#'' character; everything from to the end of the line is discarded. Secondary rules have a ``>'' character in the first column of the line; primary rules do not. The fields in each rule entry are: offset The byte offset in the file at which data should be extracted and compared to a matching string or value. datatype The type of data value to extract at the specified offset for comparison purposes; one of: ``byte'' (8 bit unsigned number), ``short'' (16 bit unsigned number), ``long'' (32 bit unsigned number), ``string'' (an array of bytes), ``istring'' (a case-insen- sitive array of bytes), or ``ascii'' (an array of ASCII-only bytes). match The value and operation to use in matching; the value used is based on the datatype field. If value is ``x'', then it is inter- preted to mean match anything; otherwise the following operators are supported (where data is the value extracted from the file and value is specified in the match field) except for types ``string'', ``istring'', and ``ascii'': = data == value != data != value > data > value < data < value <= data <= value >= data >= value & (data & value) == value ! (data & value) != value ^ (data ^ value) != 0 If no operation is specified then ``='' is used. For ``string'', ``istring'', and ``ascii'' no operator is allowed; the implicit operation is always ``=''. In these cases, the field is terminated by a tab or end of line, not by ``#''. Characters in the field have their literal value; there are no C-style character escapes. result One of ``ps'', ``tiff'', or ``error'' (case insensitive). The first two results specify whether the rule generates a POSTSCRIPT file or a TIFF/F file (Group 3-encoded bilevel data), respectively. The ``error'' result indicates that a file is unsuitable for transmission and, if supplied for transmission, should cause the job to be aborted with the command field used in an error mes- sage. command A command description that is expanded and passed to the shell to convert the input file to the result format (suitable for send- ing as facsimile). Before the string is passed to the shell, it is scanned and the following ``%'' escape codes are substituted for: %i input file name %o output file name %r output horizontal resolution in pixels/mm %R output horizontal resolution in pixels/inch %v output vertical resolution in lines/mm %V output vertical resolution in lines/inch %f data format, ``1'' for 1-d encoding or ``2'' for 2-d encoding %w page width in pixels %W page width in mm %l page length in pixels %L page length in mm %s page size by name %F the directory where HylaFAX filter programs reside %<x> the <x> character (e.g. ``%%'' results in ``%'' See below for example uses of these codes. EXAMPLES
The following rules are used to match the formats that are handled directly by the server: #offset datatype match result command 0 string %! ps # POSTSCRIPT 0 string %PDF ps # POSTSCRIPT by Ghostscript 0 short 0x4d4d tiff # big-endian TIFF 0 short 0x4949 tiff # little-endian TIFF These rules are used to process the ASCII version of IRIS Inventor database files while blocking the transmission of the binary format variant: #offset datatype match result command 0 string #Inventor V error IRIS Inventor file >15 string binary error binary IRIS Inventor file >15 string ascii ps %F/textfmt -fCourier-Bold -p11bp -U -q >%o <%i This rule is typically the last entry in the file and is used to convert all unmatched ASCII data files to POSTSCRIPT: #offset datatype match result command 0 ascii x ps %F/textfmt -fCourier-Bold -p11bp -U -q >%o <%i NOTES
It is much better to convert data that is to be transmitted to POSTSCRIPT because this data format permits the facsimile server to do the final imaging according to the optimal transfer parameters (resolution, binary encoding, etc.). It might be better to allow secondary rules to augment a primary rule rather than just replace them. This would allow, for example, com- mand line options to be selected based on file type. SEE ALSO
sendfax(1), hylafax-client(1) May 12, 1993 TYPERULES(5)
All times are GMT -4. The time now is 08:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy