a technical how to

Jerry McAllister jerrymc at clunix.cl.msu.edu
Tue Dec 9 07:01:25 PST 2003

> So, I hope this is the right address for this type of
> question. If not would you please forward this and/or
> let me know the correct address.

Is it a text or binary file?

First, I suggest working from a copy of the file for safety sake.

For a text file, Use vi.  Count down to which line is the last one 
you want to get rid of (lets say you want to get rid of 1-1152 and keep
from 1153-end).   Then, in vi, put your cursor on the first line
and do '1152dd'.     save the file off with ':wq'   and voila, you got it.

For a binary file, use dd and tell it to skip the bytes in front
and start copying from there to end to the new file.  You may also have
to play around with blocksize and notrunc to get just what you want if
you need to break it on some odd boundary.


> Thanks,
> Here is the question: How to truncate a file from the
> begining to a certain point in the file?
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

More information about the freebsd-questions mailing list