Andrew Lentvorski wrote:
> Todd Walton wrote:
>> On 8/26/07, Andrew Lentvorski <[EMAIL PROTECTED]> wrote:
>>> Is there a quick way to remove the last 10 bytes from a big honking
>>> file?
>>
>> head --bytes=-10 source.file > destination.file
> 
> Cute flag, but doesn't appear to be even remotely standard.
> 

echo "Hiya" >hiya
dd if=hiya of=hiyax2 bs=10 count=1 conv=sync
ls -l hiya hiyax2
xxd -g1 hiyax2

  the bs and conv parts illustrate extension (by nul-padding)

For truncating, you don't need any conv option

(B=big; dd if=$B bs=$(echo `stat -c"%s" $B` -10 |bc) count=1 of=little)

Above tests ok.

Still, it seems a shame to waste a minute and an inode to do a copy,
when a nice versatile debugged little utility with online help could be
written in, say a day? ;-)

Regards,
..jim


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to