CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
delete nth byte from a file


New User

Mar 3, 2009, 11:09 AM

Post #1 of 2 (2727 views)
delete nth byte from a file Can't Post

Suppose I have a large file, and I want to delete selected bytes from it by providing offsets. For example, delete the 455227th, 564649th, and 6262545th bytes from a 2 gig file.

Only way I can think of is ugly: copy the file byte-by-byte to a temp file, counting bytes and skipping the ones I want to delete.

Is there an elegant, in-place way to do this?

Veteran / Moderator

Mar 3, 2009, 11:10 AM

Post #2 of 2 (2726 views)
Re: [erwrgtwy] delete nth byte from a file [In reply to] Can't Post

perldoc -f seek

perldoc -f tell

perldoc -f sysseek

(This post was edited by FishMonger on Mar 3, 2009, 11:13 AM)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives