I'm getting a bunch of print spool files in pcl format.
I need to edit them moving graphics to i.e. right to make room for barcode stickers.
I'm trying to run a script in AIX 7.1.0.0 to edit some pcl pointer positions to the right. i.e. change p1018X to p1818X.
Piece of cake.
But.
Our beloved awk, gsub, print will nicely remove also some binary x1B.
I tried :
What I get is a (useless) much smaller file:
I'm about to give up with Aix script for such task.
I know that dd can be used to byte editing, but I never used it.
The pcl format uses the escape (ascii 27) as the record separator, it is essentially a binary file. And IMO it is not something you can edit and always get decent results.
I've written simple pcl commands in C programs that do changes to a line of text - like turn on bold.
Download ghostpcl: Note they have linux executables, so you will have to run this on a linux box. Ghostscript: GhostPCL Downloads
And see if this does what you need. The C++ coder will have to fully understand pcl code in order to make changes. Doesn't sound practical to me.
Ghostscript:ghostpcl lets you manipulate and view files.
Or a binary patching with xxd ...
A little tedious, but still good to know ...
man xxd
vi -b air01.pcl :
(or :set binary if already in)
then %!xxdLook for 7031 3031 3858 sequence and change it to 7031 3831 3858
Then change reverse %!xxd -r
Save :wq!
Handle it manually and become a nerd !
@ ctsgnb
sorry but I'm running AIX and xxd is not standard. I'm trying to keep the OS as clean as possible. Furthermore I need to automate the process.
@ Corona688
thanks. Yes I have perl. I understood that awk is a sort of shell, where gsub and print are doing the change and output. So I suppose they are the one messing things up.
I tried with tr. Nice one but it does a byte by byte replacement. I need to search for the whole string. This would be my favourite, if.....
Maybe with od? I know it is used to 'display' hex code, but I'm not sure it can be used to edit.
Another option could be dd, all examples and tutorial I found are related to changes of file blocks, filesystems etc. So I did not dare to try.
Thanks to keep searching
---------- Post updated at 04:32 PM ---------- Previous update was at 03:56 PM ----------
I don't want to be too optimistic but the following looks working:
Perl is specifically designed to be binary-safe and have unlimited line lengths, is the thing. It's better suited to editing binary files than awk.
I bet it was the line lengths that were tripping up awk. On AIX, it'd have a maximum length of 2048 or so, and a binary file would seem to awk as a small number of gigantic lines, newlines appearing anywhere only by coincidence.
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)
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)
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)
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)
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)
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)
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)
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)