LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Truncating a binary file from the command-line

[ILUG] Truncating a binary file from the command-line

Kieran.Tully AT acm.org kieran.tully at gmail.com
Thu Jun 2 12:49:31 IST 2005


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.ly  http://www.cs.tcd.ie/~tullyka



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell