The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
changing IP thru editing files bluridge SUN Solaris 2 02-26-2008 11:22 PM
the best way of editing .plist files mehow OS X (Apple) 1 01-21-2008 02:46 PM
Editing files in shell programing nir_s Shell Programming and Scripting 0 07-13-2005 01:53 AM
Editing one string in multiple files Skoshi UNIX for Dummies Questions & Answers 1 11-09-2001 10:13 PM
editing unix files on NT pixelmonkey UNIX for Dummies Questions & Answers 1 02-01-2001 08:44 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-19-2007
Registered User
 

Join Date: Jan 2007
Posts: 3
Editing files

hi i would like to know whether i can delete a part of a file in C
for eg. if my file contained
1234567890
and i want to delete
456
so that it becomes
1237890

is there a way i can do this.

well, one way i can achieve this is by creating a new file, copy whatever i want, then delete the old file and rename the new file with the name of the old file.
but i was wondering whether it can be done in directly, i.e. without doing any copies.

plz help
regards
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-19-2007
Registered User
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 204
sed 's/456//' /file > /tmp/file ; mv /tmp/file /file

not C but works fine, but I'm not shure if thats what you want
Reply With Quote
  #3 (permalink)  
Old 01-19-2007
Registered User
 

Join Date: Jan 2007
Posts: 3
thats not what i want to do
actually the file is a binary file and say i want to seek 500 bytes in the file and then delete 200bytes from that point.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0