05-23-2008
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.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm doing a bit of hex editing with dd and I can replace values fairly simply. However, I've run across a situation where I need to delete bytes in the file and I'm not sure how to do that. For example:
Input file has:
1234567890
Output needs to be:
123abc90
I tried this:
printf... (6 Replies)
Discussion started by: Loriel
6 Replies
2. Shell Programming and Scripting
Hi guys,
I am in need of a simple, (typically one-liner) script to get the last 17 bytes of a line.
Eg.
echo "abcdefghijklmnopqrstuv"
here i would need the last 17 bytes of the text
ie. fghijklmnopqrstuv
The text length is dymanic (but always more than 17)...it can even span upto... (2 Replies)
Discussion started by: n_rajitr
2 Replies
3. Shell Programming and Scripting
Hi,
Please shed some light on how to quickly remove all the zero bytes in which there are some mixtures of more than zero bytes in it.
For eg:
> ls -lrt
-rw-r--r-- 1 ab noen 0 Jul 27 15:47 supplier_mp.unl
-rw-rw-r-- 1 ab noen 507 Aug 5 14:13... (2 Replies)
Discussion started by: cedrichiu
2 Replies
4. UNIX for Dummies Questions & Answers
Hi,
How do I check for the total bytes of character used by a file?
Can I used a od command to check?
Thanks. (1 Reply)
Discussion started by: user50210
1 Replies
5. Shell Programming and Scripting
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
6. Programming
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
7. UNIX for Dummies Questions & Answers
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
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
is there a better way to do this:
head -c 10000k /var/dump.log | head -c 6000k
unfortunately, the "-c" option is not available on sun solaris. so i'm looking at "dd". but i dont know how to use it to achieve the same exact goal as the above head command.
this needs to work on both solaris... (5 Replies)
Discussion started by: SkySmart
5 Replies
10. Shell Programming and Scripting
Hello to all,
I would like to search sequences of bytes inside big binary file.
The bin file contains blocks of information, each block begins is estructured as follow:
1- Each block begins with the hex 32 (1 byte) and ends with FF. After the FF of the last block, it follows 33.
2- Next... (59 Replies)
Discussion started by: Ophiuchus
59 Replies
LEARN ABOUT DEBIAN
cfdisk
CFDISK(8) GNU cfdisk Manual CFDISK(8)
NAME
GNU cfdisk - a curses-based partition table manipulation program
SYNOPSIS
cfdisk [options] [device]
DESCRIPTION
cfdisk is a disk partition manipulation program, which allows you to create, destroy, resize, move and copy partitions on a hard drive
using a simple menu-driven interface. It is useful for organising the disk space on a new drive, reorganising an old drive, creating space
for new operating systems, and copying data to new hard disks. For a list of the supported partition types, see the --list-partition-types
option below.
OPTIONS
-h, --help
displays a help message.
-v, --version
displays the program's version.
-a, --arrow-cursor
use an arrow cursor, instead of reverse video highlighting, in case your terminal doesn't support it.
-z, --new-table
create a new partition table on the disk. This is useful if you want to change the partition table type or want to repartition you
entire drive. Note that this does not delete the old table on the disk until you commit the changes.
-u, --units=UNIT
sets the default display units to UNIT. A list of possible units is given below.
-t, --list-partition-types
displays a list of supported partition types and features.
UNITS
You can choose in what unit cfdisk should display quantities like partition sizes. You can choose from sectors, percents, bytes, kilobytes,
etc. Note that one kilobyte is equal to 1,000 bytes, as this is consistent with the SI prefixes and is used by hard disk manufacturers. If
you prefer to see the sizes in units with binary prefixes, you should instead select one kilo binary byte (kibibyte), which is equal to
1,024 bytes. Whatever display unit you have chosen, you can always enter the quantities in the unit of your choice, for example 1000000B or
1000kB.
compact
display each size in the most suitable unit from B, kB, MB, GB and TB.
B one byte
kB one kilobyte (1,000 bytes)
MB one megabyte (1,000,000 bytes)
GB one gigabyte (1,000,000,000 bytes)
TB one terabyte (1,000,000,000,000 bytes)
KiB one kilo binary byte (1,024 bytes)
MiB one mega binary byte (1,048,576 bytes)
GiB one giga binary byte (1,073,741,824 bytes)
TiB one tera binary byte (1,099,511,627,776 bytes)
s one sector. It depends on the sector size of the disk. You can use it if you want to see or choose the exact size in sectors.
% one percent from the size of the disk
cyl one cylinder. It depends on the cylinder size.
chs use CHS display units.
BUGS
There are no known bugs. We are in early stages for development, so be careful.
SEE ALSO
fdisk(8), mkfs(8), parted(8) The cfdisk program is fully documented in the info(1) format GNU cfdisk User Manual manual.
fdisk 16 June, 2006 CFDISK(8)