Is there a simple way to truncate a file to a given length from the
command-line?
Or, more particularly, given a binary file "records" of size 5104 bytes,
is there a one-liner to destructively truncate it to the closest multiple
of 10 bytes, discarding the extra 4 bytes?
I'm thinking "dd" could do it but I don't want the overhead of
copying the file.
I'm aware of truncate(2) so I may just call it with perl -e.
This is on RedHat 9 if it makes a difference.
Thanks,
--
Kieran Tully, Software Developer and Tenor
Reply to Kieran.Tully AT acm.org
http://kieran.tul.lyhttp://www.cs.tcd.ie/~tullyka
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!