Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

csplit losing part of remaining file

Status
Not open for further replies.

eholdo

Technical User
May 30, 2002
31
US
I'm trying to use csplit on a 2 MB file. The split occurs correctly, but the second file created only created 650K or so rather than the 2MB or so it should be.

Help!! All I'm trying to do is spli out a certain number of lines at the header of the file, based on the existence of a string (\xpif) in the file, and leave the rest of the file intact.
 
What is exactly the csplit command you're running ?
Anyway you can play with awk:
Code:
awk 'BEGIN{out="/path/to/header"}
/\\xpif/{out="/path/to/second"}
{print >out}
' /path/to/orig

Hope This Help
PH.
 
I found why it's dumping the file. There is a NULL character (\000) in the file, and at that point, to some point further in the file, it's just getting wiped out. There's only one NULL, but I can't remove it, because if corrupts the second part of the file....


...so, is there a method of doing a binary split of the file?
 
To remove the NULL value:
Code:
tr -d '\000' <input >output

Hope This Help
PH.
 
If you want to replace the NULL by another char (SPACE in this example) :

[tt]tr '\000' ' ' <input >output[/tt]

Jean Pierre.
 
Thanks everyone for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top