How to edit a pcl (binary) file ?

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers How to edit a pcl (binary) file ?
# 8  
Old 10-26-2016
Yes, the files look unchanged from a binary point of view, same size. Also printout is OK, just the wanted changes, everything else is unchanged.
And yes, the line lenght of my file is huge. awk just goes beserk.


The challenge now is to find&edit a string with both escape char and ascii, i.e.
Code:
FIND:
*p1088Y[Esc]*c100g2P

REPLACE with:
*p4088Y[Esc]*c200g2P

where [Esc] is the hex 1B

Thanks.

Last edited by emare; 10-26-2016 at 12:59 PM..
This User Gave Thanks to emare For This Post:
# 9  
Old 10-26-2016
This seems to work:

Code:
$ printf "*p1088Y\x1b*c100g2P" | perl -p -e 's/[*]p1088Y\x1b[*]c100g2P/*p4088Y\x1b*c200g2P/g;' | hexdump -C

00000000  2a 70 34 30 38 38 59 1b  2a 63 32 30 30 67 32 50  |*p4088Y.*c200g2P|
00000010

$

The [*] is to make Perl use asterisk as a literal character instead of a wildcard modifier. The second half of the expression is just taken literally anyway.
This User Gave Thanks to Corona688 For This Post:
# 10  
Old 10-26-2016
Thanks Corona688!
Tomorrow I will check!
# 11  
Old 10-31-2016
Quote:
Originally Posted by Corona688
Perl is specifically designed to be binary-safe and have unlimited line lengths, is the thing.
Just like the GNU sed, doesn't it ?
# 12  
Old 10-31-2016
Hi.

If the perl solution from Corona688 works, then use it.

Otherwise here are some alternatives, but unknown if they exist in AIX:
Code:
bbe - sed-like editor for binary files
beav - binary editor and viewer
bless - A full featured hexadecimal editor
bvi - binary file editor

dhex - ncurses based hex editor with diff mode
hexer - interactive binary editor with a Vi-like interface
jeex - visual editor to view and edit files in hexadecimal
le - Text editor with block and binary operations

lfhex - large file hex editor
ncurses-hexedit - Edit files/disks in hex, ASCII and EBCDIC
okteta - hexadecimal editor for binary files
radare2 - free and advanced command line hexadecimal editor

shed - A simple hex editor with a pico-style interface
tweak - Efficient text-mode hex editor

Best wishes ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert binary file to csv and then back to the binary format

Hello *nix specialists, Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies

2. Programming

Adding to a PCL file for print

I am trying to add some variable print to a list of pcl files within a folder. Am doing some programming within perl, bash and some other scripts. (Open to a format and language). I need to add an incrementing number (variable that will increment by one each time) to the first page of each pcl... (2 Replies)
Discussion started by: mach1
2 Replies

3. Shell Programming and Scripting

Adding to a PCL file for print - in a script

I am trying to add some variable print to a list of pcl files within a folder. Am doing some programming within perl, bash and some other scripts. (Open to a format and language). I need to add an incrementing number (variable that will increment by one each time) to the first page of each pcl... (1 Reply)
Discussion started by: mach1
1 Replies

4. UNIX for Dummies Questions & Answers

Create a PCL DUPLEX File using ghostscript-8.62

table.ubbfoot {background-color="#9999ff"} td.ubbfoot1 {font-size=8pt; font-family=arial,helvietica,swiss; color="#000000";} td.ubbfoot2 {font-size=8pt; font-family=arial,helvietica,swiss; color="#ffffff";} hello, i want to create PCL Duplex Output (to print) from a pdf File. i uses itanium (64)... (0 Replies)
Discussion started by: chzi
0 Replies

5. AIX

How convert PCL or PDF file to text in AIX

I need to conver a PCL or PDF file to text in AIX, and I donīt know how. (0 Replies)
Discussion started by: 10789
0 Replies

6. HP-UX

HP/Ux pcl printing

Hi, I have a pcl file with a color invoice. Can you please advise me how I can print it directly from Hp/Ux command line to a network printer with a known IP address. The printer model is Xerox Docu Color 1632. How can I configure that printer under HpUx and which command is for printing pcl... (2 Replies)
Discussion started by: piooooter
2 Replies

7. Solaris

compiled binary file gives "cannot execute binary file"

Hi, I have two Solaris machines. 1. SunOS X 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Blade-1500 2. SunOS Y 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-60 I am trying to buiild a project on both these machines. The Binary output file compiled on machine 2 runs on both the machines. Where... (0 Replies)
Discussion started by: scgupta
0 Replies

8. HP-UX

PCL question

Good People, My issue is an aging laserjet4si and its inability to interpret anything beyond PCLv2. Would anyone happen to know an easy way to force just one queue into using only PCL2 formatting? I dug around in the interface script and in model.orig but didn't see anything immmediately... (0 Replies)
Discussion started by: Eronysis
0 Replies

9. UNIX for Dummies Questions & Answers

print a file contains binary and pcl file

I have a file that contain printer escape codes and text. How can I place the image on the top of each page in that file and print that text file out with the image in Unix. Thank you. (0 Replies)
Discussion started by: caol
0 Replies
Login or Register to Ask a Question