smart question

eg. : there is a file - 322 bytes,
how can I (or you) view just a half of file (161 bytes)?

what if the size of the file is odd number

assuming your input file is in_file. You could code something like this

#! /usr/bin/ksh

size=$(wc -c in_file | awk -F " " '{print $1}')
half_size=`expr $size / 2`
split -b $half_size in_file

The result of the final split command will be two or three files name xaa, xab and xac. you will get two files if the in_file is even number in size else three files with the last file xac being just 1 byte.
If you wanted the first half just read xaa, else read xab and xac if available for the latter.

jerardfjay

try:

 head -c -n 168 filename

This prints the first 168 bytes in the file.