On Sat, 2013-06-29 at 12:34 -0400, Stephen Powell wrote: > I have a need to pad a binary file with some character > (probably a null character) so that its total length > is a multiple of some number. For example, I have a file > called kernel.debian, whose size is 6319616 bytes. I need > to pad it with nulls until its length is a multiple of 80. > The next higher multiple of 80 is 6319680, which can be > obtained by padding the file with 64 null characters. > In CMS, the FBLOCK CMS Pipelines stage will do the trick. > For example, > > PIPE < KERNEL DEBIAN A1 | FBLOCK 80 00 | > KERNEL1 DEBIAN A1 F > > This will create an output file with fixed-length 80-byte > records, padded as necessary at the end with null characters, > so that all records are exactly 80 bytes long. > > I am looking for a way to do this padding in Linux. > A search of the internet using the keywords "pad file Linux" > did not seem to produce any useful results. Does anyone know > how to accomplish this?
truncate -s %80 FILENAME Will pad with zero's to round size up to a multiple of 80. -- Tixy -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/1372526362.3434.3.ca...@computer5.home