Sponsored Content
Top Forums Shell Programming and Scripting Comp-3 conversion possible with Shell Scripting or PERL? Post 68039 by Perderabo on Wednesday 30th of March 2005 10:57:37 AM
Old 03-30-2005
So the total field is numeric rather than packed decimal? I think this should do it:
high5=$(print -n \\0377\\0377\\0377\\0377\\0377)

Define your total field like this:
typeset -Z5 total
to get the leading zeroes you will need.

Remember that ksh will add new line characters unless you supress them:
print -n ${high5}${total}

To test this:
Code:
$ cat x
#! /usr/bin/ksh
high5=$(print -n \\0377\\0377\\0377\\0377\\0377)
typeset -Z5 total
total=123
print -n ${high5}${total} | od -t x1
$  ./x
0000000   ff  ff  ff  ff  ff  30  30  31  32  33
0000012
$

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Another bash shell to perl conversion

Hello everyone. I am new to linux and need help again. I need help converting this bash shell to linux: for i in `ls -l *.txt` do `./cnvidtf.pl $i` `curl -u login:pswd --disable-espv -T loadfile.seq ftp://11.1.11.1` `mysql -u login -h 11.1.11.1 -ppswd < lddocs.sql` done Thanks! Any help... (6 Replies)
Discussion started by: freak
6 Replies

2. Shell Programming and Scripting

Should I use PERL or Shell scripting?

Hello, I have done some BASIC shell scripting/PERL scripting before so I am familiar with the languages. I am not really sure which one would lend itself better to the application I have to write. I am required to scan the message logs for possible break in attempts. If I use shell scripting... (3 Replies)
Discussion started by: mojoman
3 Replies

3. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

4. Shell Programming and Scripting

Linux/Unix shell scripting vs Perl

Hi, I have general question: i have good working Perl script with .pl extension, and now I have to migrate all to another Linux box, and I was told that I can use only shell scripting, so I'm not sure how different those two things are, will it work without any changes . Is there anything smart I... (6 Replies)
Discussion started by: trento17
6 Replies

5. What is on Your Mind?

Shell scripting vs Perl scripting

Hi all, I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first. Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies

6. Shell Programming and Scripting

Conversion from Perl to Shell scripting

Hai ! I am doing a research on Bioinformatics and a part of the code in perl have to be converted to shell scripting. I am new to shell programming. Pls. kindly help me to convert this code to shell script though it is somewhat lengthy. PLS KINDLY HELP ME. THANKS IN ADVANCE. my @FreeEnergy =... (1 Reply)
Discussion started by: kswapnadevi
1 Replies

7. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

8. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

9. Shell Programming and Scripting

shell or perl script needed for ldif file to text file conversion

This is the ldf file dn: sdcsmsisdn=1000000049,sdcsDatabase=subscriberCache,dc=example,dc=com objectClass: sdcsSubscriber objectClass: top postalCode: 29600 sdcsServiceLevel: 10 sdcsCustomerType: 14 givenName: Adelia sdcsBlackListAll: FALSE sdcsOwnerType: T-Mobile sn: Actionteam... (1 Reply)
Discussion started by: LinuxFriend
1 Replies

10. Shell Programming and Scripting

Help required for Oracle database shutdown script conversion from shell to perl

Please tell me how to convert below program from shell script to perl. Same commands need to use in shutdown, just need program help for startup. export ORACLE_BASE=/home/oracle1 lsnrctl start lndb1 sqlplus '/ as sysdba' startup; (2 Replies)
Discussion started by: learnbash
2 Replies
term(4) 						     Kernel Interfaces Manual							   term(4)

NAME
term - format of compiled term file SYNOPSIS
DESCRIPTION
Compiled terminfo descriptions are placed under the directory In order to avoid a linear search of a huge HP-UX system directory, a two- level scheme is used: where name is the name of the terminal, and c is the first character of name. Thus, can be found in the file Syn- onyms for the same terminal are implemented by multiple links to the same compiled file. The format has been chosen so that it is the same on all hardware. An 8-bit or longer byte is assumed, but no assumptions about byte ordering or sign extension are made. The compiled file is created using the program (see tic(1M)), and read by the routine. The file is divided into the following six parts: 1. The header section begins the file and contains six short integers in the following format: 1. Magic number (octal 0432); 2. Size, in bytes, of the names section; 3. Number of bytes in the Boolean section; 4. Number of short integers in the numbers section; 5. Number of offsets (short integers) in the strings section; 6. Size, in bytes, of the string table. Short integers are stored in two 8-bit bytes. The first byte contains the least significant 8 bits of the value; the second byte contains the most significant 8 bits. (Thus, the value represented is 256*second+first.) The value -1 is represented by other negative values are illegal. The -1 generally means that a capability is missing from this terminal. Note that this format corresponds to the hardware of the VAX and PDP-11. Machines where this does not correspond to the hardware read the integers as two bytes and compute the result. 2. The terminal names section comes next. It contains the first line of the terminfo description, listing the various names for the terminal, separated by the character. The section is terminated with an ASCII NUL character. 3. In the Boolean section, the Boolean flags have one byte for each flag. This byte is either or as the flag is absent or present, respectively. The capabilities are in the same order as they are listed in the file Between the Boolean section and the number section, a null byte will be inserted, if necessary, to ensure that the number section begins on an even byte. All short integers are aligned on a short word boundary. 4. The numbers section is similar to the flags section. Each capability consists of two bytes, and is stored as a short inte- ger. If the value represented is -1, the capability is considered missing. 5. The strings section is also similar. Each capability is stored as a short integer in the format above. A value of -1 means the capability is missing. Otherwise, the value is taken as an offset from the beginning of the string table. Special char- acters in or notation are stored in their interpreted form, not the printing representation. Padding information and parame- ter information are stored intact in uninterpreted form. 6. The final section is the string table. It contains all the values of string capabilities referenced in the string section. Each string is null terminated. Note that it is possible for to expect a different set of capabilities than are actually present in the file. Either the database might have been updated since has been recompiled (resulting in extra unrecognized entries in the file) or the program may have been recompiled more recently than the database was updated (resulting in missing entries). The routine must be prepared for both possibilities, which is why the numbers and sizes are included. Also, new capabilities must always be added at the end of the lists of Boolean, number, and string capabilities. The following example is an octal dump of the description for the HP Portable Computer (HP-110): 110|hp110|hp110a portable computer, am, xhp, da, db, mir, cols#80, lines#16, lm#0, cbt=Ei, bel=^G, cr= , tbc=E3, clear=E&a0y0CEJ, el=EK, ed=EJ, hpa=E&a%p1%dC, cup=E&a%p1%dy%p2%dC, cud1=EB, cub1=, cuf1=EC, cuu1=EA, cvvis=E&j@, dch1=EP, dl1=EM, smir=EQ, smso=E&dB, sgr0=E&d@, rmir=ER, rmso=E&d@, is2=E&j@, if=/usr/share/lib/tabset/stdcrt, il1=EL, kbs=, kcud1=EB, khome=Eh, kcub1=ED, kcuf1=EC, kcuu1=EA, rmkx=E&s0A, smkx=E&s1A, vpa=E&a%p1%dY, ind= , hts=E1, ht= , 0000 032 001 # 025  223 254 1 1 0 | 0020 h p 1 1 0 | h p 1 1 0 a p o r 0040 t a b l e c o m p u t e r 0060 001 001 001 001 001 0100 P 377 377 020 377 377 377 377 0120 377 377 377 377 003 005 377 377 007 0140 024 027 032 377 377 $ 4 377 377 377 377 0160 7 377 377 377 377 9 377 377 < ? D 0200 G 377 377 377 377 377 377 377 377 377 377 377 377 377 377 0220 377 377 J 377 377 377 377 377 377 M 377 377 377 377 0240 377 377 R 377 377 377 377 W Z 377 377 377 377 0260 377 377 377 377 377 377 _ 377 377 d 377 377 { 0300 377 377 ~ 377 377 377 377 377 377 377 377 377 377 200 0320 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 0340 377 377 377 377 377 377 377 377 377 377 377 377 203 377 377 0360 377 377 206 377 377 377 377 377 377 211 377 377 377 377 0400 377 377 214 217 225 377 377 377 377 377 377 377 377 0420 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 0520 377 377 233 377 377 245 377 377 377 377 247 377 377 0540 252 377 377 377 377 377 377 377 377 377 377 377 377 377 377 0560 377 377 377 377 377 377 377 377 377 377 033 i 007 0600 033 3 033 & a 0 y 0 C 033 J 033 K 0620 033 J 033 & a % p 1 % d C 033 & 0640 a % p 1 % d y % p 2 % d C 033 B 0660  033 C 033 A 033 & j @ 033 P 0700 033 M 033 Q 033 & d B 033 & d @ 0720 033 R 033 & d @ 033 & j @ / u 0740 s r / l i b / t a b s e t / s t 0760 d c r t 033 L  033 B 033 h 1000 033 D 033 C 033 A 033 & s 0 A 033 1020 & s 1 A 033 & a % p 1 % d Y 1040 033 1 1046 WARNINGS
Total compiled entries cannot exceed 4096 bytes. The name field cannot exceed 128 bytes. Hewlett-Packard Company supports only those terminals that are listed on the current list of supported devices. However, both non-sup- ported and supported terminals may be in the terminfo database. If non-supported terminals are used, they may not work correctly. FILES
compiled terminal capability data base SEE ALSO
tic(1M), untic(1M), terminfo(4). term(4)
All times are GMT -4. The time now is 05:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy