Printing bytes


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
Printing bytes

Hi,

I have packed fields for which I am trying to print bytes. when I try cut -b2 it does print the 2nd byte besides that it also prints additional byte that I am not aware offSmilie data looks something like this

Code:
Input:
135
246

when I try cut -b2 it gives me

Code:
30
4A

but I need the output as

Code:
3
4

# 2  
Weird... try: cut -b 2-2
# 3  
doesnt help - Any other trick???
# 4  
how 'bout:
Code:
LANG=C cut -b 2-2 myFile

# 5  
still the same. Smilie

Well, I am not sure why this is behaving like this with the packed decimal field????
# 6  
Please show us the output of:
Code:
uname -a
locale

You do realize that a packed decimal field has bytes that are unprintable - assuming this is one of the IBM packed formats.
http://publib.boulder.ibm.com/iserie...0925083170.htm
# 7  
its AIX XXXXXXXXXXX 3 5 00C9C5204C00

LANG=en_GB
LC_COLLATE=en_GB
LC_CTYPE=en_GB
LC_MONETARY=en_GB
LC_NUMERIC=en_GB
LC_TIME=en_GB
LC_MESSAGES=en_GB
LC_ALL=

yes, I do understand that packed decimals would have unprintable characters. However, I was refering to the bytes in it. so, does that mean cut doesnt work with different formats?
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #463
Difficulty: Medium
chrony is an implementation of the Network Time Protocol (NTP) and is a replacement for the ntpd.
True or False?

10 More Discussions You Might Find Interesting

1. Programming

Best way to axe N bytes from the right?

say that i have strings that end in "text" foo.9.text, bar.10.text, baz.11.text and i want a C function to chop off the last four characters and replace each string with a '\0'; obviously with error-checking. Any ideas? TIA! (7 Replies)
Discussion started by: Gary Kline
7 Replies

2. Shell Programming and Scripting

Shell script - entered input(1-40 bytes) needs to be converted exactly 40 bytes

hello, suppose, entered input is of 1-40 bytes, i need it to be converted to 40 bytes exactly. example: if i have entered my name anywhere between 1-40 i want it to be stored with 40 bytes exactly. enter your name: donald duck (this is of 11 bytes) expected is as below - display 11... (3 Replies)
Discussion started by: shravan.300
3 Replies

3. UNIX for Dummies Questions & Answers

X bytes of 0, Y bytes of random data, Z bytes of 5, T bytes of 1. ??

Hello guys. I really hope someone will help me with this one.. So, I have to write this script who: - creates a file home/student/vmdisk of 10 mb - formats that file to ext3 - mounts that partition to /mnt/partition - creates a file /mnt/partition/data. In this file, there will... (1 Reply)
Discussion started by: razolo13
1 Replies

4. Shell Programming and Scripting

Help printing files in ascending order of the fi le size (in bytes)

Hey guys I'm new to unix and need help printing files in a specified directory according to size in bytes as well as files with equal bites in alphabetical order the part i have done so far prints out all files in the directory as well as setting a time limit in which they have been modified ... (2 Replies)
Discussion started by: wessy
2 Replies

5. UNIX for Dummies Questions & Answers

Sco Unix printing : jobs hangs in queue - printing via lp versus hpnpf

Hi, We have a Unix 3.2v5.0.5. I installed a printer via scoadmin, HP network printer manager with network peripheral name (hostname and ipadres are in /etc/hosts). This is the configuration file : Code: root@sco1 # cat configurationBanner: on:AlwaysContent types: simpleDevice:... (0 Replies)
Discussion started by: haezeban
0 Replies

6. Windows & DOS: Issues & Discussions

Linux to Windows Printing: PDF starts printing from middle of page.

We are using Red Hat. We have a issue like this: We want to print from Linux, to a printer attached to a Windows machine. What we want to print is a PDF. It prints, but the printing starts from the middle of the page. In the report, there is no space at the top but still printing starts from the... (5 Replies)
Discussion started by: rohan69
5 Replies

7. Programming

Copying 1024 bytes data in 3-bytes chunk

Hi, If I want to copy a 1024 byte data stream in to the target location in 3-bytes chunk, I guess I can use the following script. dd bs=1024 count=3 if=/src of=/dest But, I would like to know, how to do it via a C program. I have tried this with memcpy(), that did not help. (3 Replies)
Discussion started by: royalibrahim
3 Replies

8. Shell Programming and Scripting

Error PHP Fatal error: Allowed memory size of 67108864 bytes exhausted(tried to allocate 401 bytes)

While running script I am getting an error like Few lines in data are not being processed. After googling it I came to know that adding such line would give some memory to it ini_set("memory_limit","64M"); my input file size is 1 GB. Is that memory limit is based on RAM we have on... (1 Reply)
Discussion started by: elamurugu
1 Replies

9. Shell Programming and Scripting

Remove first N bytes and last N bytes from a binary file on AIX.

Hi all, Does anybody know or guide me on how to remove the first N bytes and the last N bytes from a binary file? Is there any AWK or SED or any command that I can use to achieve this? Your help is greatly appreciated!! Best Regards, Naveen. (1 Reply)
Discussion started by: naveendronavall
1 Replies

10. UNIX for Advanced & Expert Users

Printing Problems in unix ... ( Bar-cdoe - Ip Printing)

Hi guys ... i need ur help with some printing problem in unix ... first prob. : i wanna print from my NCR unix to an Win NT , Ip based printing server ( HP JetDirect ) . My issue , is it possible to print directly to an Ip address from unix ? How do i make it work to get any results ?... (3 Replies)
Discussion started by: QuickSilver
3 Replies

Featured Tech Videos