Visit Our UNIX and Linux User Community


escape codes


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers escape codes
# 1  
Old 08-14-2003
Question escape codes

I did a search and found the link for escape codes,- but I am not sure how to modify this script to set the margins.
I started with a script that was already written on my system to set a printer to print landscape. I need to send an report that is in an ascii file to multiple printers from my application. My application allows me to execute scirpts in leu of printing to a device directly...

I am on digital alpha 4.0d (yes I know its old but I cant do anything about it!)

here is my script:
#!/bin/ksh
print_report()
{
(echo "${INITLJ4}${FONTLJ4}\c"
cat ${CONTROL} | sed -e "s/$//" -e "s/^/ /"
echo "${RESETLJ4}\c") | lp -d$DESTNAME
}

CONTROL=/usr6/users/rptdist.lis

INITLJ4="\033E\033&a3L\033&l1o5.45c2a66F\033(12U\033(s10H\033&l5H\033(s0p10h0s0
4099T\033&k11.6H"

FONTLJ4="\033(s0p17.1h8.5v0T\033&k7.0H"
RESETLJ4="\033E\033&l0o\033(s10H\033&l5H\033(s0p10h0s0b4099T\033&k11.6H"

DESTNAME=printer1
print_report
DESTNAME=printer1
print_report

****
The report prints too far to the right and needs to be moved to the left. I found the code that I need to put in...
EC&l#E
which translates to 033&l#E

But where in the above do I put it? do I put all page control commands on the what is the INIT line?
Is there a good book that explains doing this and if there is a certain order to the parameters? or are they always in the order that you see them in the manual?

Am I clear as mud on what I'm trying to do?

Smilie Smilie
# 2  
Old 08-14-2003
The escape sequences are commands. You link them together to form little programs. The order in the book probably has little to do with it.

Very often you have to assemble a program and try it out. If it works, cool. Otherwise, it's back to the drawing board.

I don't know what the other escape sequences do, so I am flying blind. But it looks like the INITLJ4 is setting things up. So I would try putting it as the first thing in that string. If a later escape sequence will undo this effect, then you may need to move it.
 

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Auto escape script to escape special chars in script args

This is a bit off the wall, but I often need to run scripts where there are argument values that contain special characters. For example, $ ./process.exe -t M -N -o temp.mol.s -i ../molfiles/N,N\',N\'\'-trimethylbis\(hexamethylene\)triamine.mol && sfile_space_to_tab.sh temp.mol.s temp.s It... (1 Reply)
Discussion started by: LMHmedchem
1 Replies

2. UNIX for Advanced & Expert Users

CUPS printing and control escape codes

I ported application from SysV to Linux and run into troubles with printing. Application uses lp and HP JetDirect-based printers, it inserts HP control codes in the file and uses plain lp -d dest doc-file command to print it. The Linux (Ubuntu 8) has CUPS system, which I am not familiar... (0 Replies)
Discussion started by: migurus
0 Replies

3. Shell Programming and Scripting

'watch' not interpreting escape codes in bash script

Hi there, I'm fairly new to bash scripting and already having some troubles. I'm making a script that can print some series of strings in colors based in the information of a file, for simplicity let's say it only does: #!/bin/bash printf "\eWhen you execute this in the command line it... (1 Reply)
Discussion started by: Arashi
1 Replies

4. Ubuntu

rdiff-backup using escape codes on vfat thumbdrive

I thought it may be nice to use rdiff-backup to backup my websites to a thumb drive. But all the capital letters are substituted with octal escape codes. How can I over come this? There are no issues backing up to another ext3 drive. The source drive is ext3 the thumb drive is vfat mounted... (0 Replies)
Discussion started by: mikemc
0 Replies

5. AIX

Warning codes

Dear Experts, i am very to AIX when i am trying to compile my code i am getting two warning several times like 1540-0053 (W) The declaration of a class member within the class definition must not be qualified. "/usr/include/alloca.h", line 34.9: 1540-1401 (I) An unknown "pragma __alloca" is... (1 Reply)
Discussion started by: vin_pll
1 Replies

6. UNIX for Dummies Questions & Answers

Using color escape codes in less

Hi all, Not sure how "for dummies" this question is, but I'd better use understatement... A. My Environment ============== I am using RedHat Linux, version 2.6.18-53.el5. When I type less --version I get: less 394 Copyright (C) 1984-2005 Mark Nudelman ... My terminal is configured... (1 Reply)
Discussion started by: Source2Exe
1 Replies

7. Shell Programming and Scripting

help with return codes

Hi In an unix script I am using an Perl one liner perl -i -ne '-----' If the perl one liner fails i am not able to catch the return code. It always give 0 as return code. Can you tell me how can i catch the return code perl -i -ne '---' RETCODE=$? echo $RETCODE Thanks and Regards Ammu (2 Replies)
Discussion started by: ammu
2 Replies

8. UNIX for Advanced & Expert Users

Return Codes

I have a simple script which renames a file.How do i capture the return code of the script if the script fails (3 Replies)
Discussion started by: kris01752
3 Replies

9. UNIX for Dummies Questions & Answers

Return codes

Hi, Can anyone tell me if there are return codes for SFTP? If so how would you capture them? I've tried 'man sftp' but its not particularly helpful. Many thanks Helen :confused: (4 Replies)
Discussion started by: Bab00shka
4 Replies

10. Shell Programming and Scripting

can anyone explain this codes here?

nawk 'FNR > 3 {printf("%s%c", $0, OFS)}END{print ""}' "$1" > "$1".out && mv "$1 ".out "$1" what is FNR? or printf("%s%c",$0, OFS)}? sorry..im lost... (2 Replies)
Discussion started by: forevercalz
2 Replies

Featured Tech Videos