head command

From: Darren Brechman-Toussaint (Darren.Toussaint@securitymail.com.au)
Date: Mon Nov 11 2002 - 19:26:35 EST


Hi all,

We have recently upgraded from Solaris 2.6 to 8, and have noticed a change in the way the head
command works. We have a text file that the first line consists of 23 'normal' characters followed
by about 28 null (hex 00) characters and a end-of-line character (hex 0a). Under Solaris 2.6 'head
-1 testfile.txt | wc -c' would return 23 (this would be enough for our needs), and under Solaris 8
the same command run on the same file returns 73.

Without the wc -c part of the command line, the 'head -1 testfile.txt' actually returns the first 2
lines of data without the null chars and EOL char from the original first line. It seams as though
the head command has changed the way it reads null chars and also incorrectly misses the first EOL
char.

Below is a hex dump of the original first 2 lines of the textfile and the output from 'head -1
testfile.txt' run on solaris 2.6 and solaris 8.

Any help would be greatly appreciated
Darren

00000000 30303032 30303231 30313930 353a3031 0002002101905:01
00000010 3a323030 33320000 00000000 00000000 :20032..........
00000020 00000000 00000000 00000000 00000000 ................
00000030 00000a30 37202033 32373230 30303020 ...07 32720000
00000040 20333237 32303939 39202030 37202033 32720999 07 3
00000050 32373431 35343920 2041444e 4f423141 2741549 ADNOB1A
00000060 444e4f42 310a DNOB1.

Solaris 2.6, head -1 testfile.txt returns:
"0002002101905:01:20032"
hex output
00000000 30303032 30303231 30313930 353a3031 0002002101905:01
00000010 3a323030 3332 :20032

Solaris 8, head -1 testfile.txt returns:
"0002002101905:01:2003207 32720000 32720999 07 32741549 ADNOB1ADNOB1"
hex output
00000000 30303032 30303231 30313930 353a3031 0002002101905:01
00000010 3a323030 33323037 20203332 37323030 :2003207 327200
00000020 30302020 33323732 30393939 20203037 00 32720999 07
00000030 20203332 37343135 34392020 41444e4f 32741549 ADNO
00000040 42314144 4e4f4231 0a B1ADNOB1.
This e-mail message and any attached files are intended only for the use of the addressee named
above, and contains confidential information. If you are not the intended recipient, any use,
disclosure or copying of this e-mail is unauthorised. If you have received this e-mail in error,
please notify the sender immediately by reply e-mail and delete this e-mail from your computer. We
use virus scanning software but exclude all liability for viruses or similar in any attachment.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:25:16 EDT