Thanks, those binary zeros in that context could cause a real mess.
On Tue, 26 Sep 2017, Linux for blind general discussion wrote:

Date: Tue, 26 Sep 2017 00:10:43
From: Linux for blind general discussion <blinux-list@redhat.com>
To: Linux for blind general discussion <blinux-list@redhat.com>
Subject: Re: shell editor

The truncate command will likely have an undesired side-effect: if the
file is smaller than the target size, it will be generally be padded with
binary zeroes to force it to be the specified size.

If pure truncation is desired, might I suggest the dd command instead:
 dd if=input-file of=output-file bs=maxlength count=1
If the input-file is shorter than maxlength, output-file will be the
same as input-file (not padded to maxlength).
(warning: maxlength has a limit, but that limit is usually at least 100 Meg.)

On Mon, Sep 25, 2017 at 18:07:24PM -0400, Linux for blind general discussion 
wrote:
This isn't what was requested, but I'm pretty certain it will be useful
nonetheless.  The truncate command can create a file and make it a
specific number of characters in size.  Truncation happens from the end of
the file if too large.  So truncate 10000 file.txt would make a file 10000
characters in length.  Editing that file in overwrite mode not insert mode
change lines don't insert lines would use up the space for the character
limit on the file.  Saving an edit; then truncating the file again but to
a different file name than the original then comm -2 file1 file2 would
show lines only in file2 not in file1.

_______________________________________________
Blinux-list mailing list
Blinux-list@redhat.com
https://www.redhat.com/mailman/listinfo/blinux-list


--

_______________________________________________
Blinux-list mailing list
Blinux-list@redhat.com
https://www.redhat.com/mailman/listinfo/blinux-list

Reply via email to