is this on a unix or linux box?
Main Topics
Browse All TopicsHi,
I have a large but simple XML file (10gb) that i need to split into a group of smaller files, no larger that 1gb.
Is there a simple perl script that i can use to perform this task ?
A sample of the record contained within the file is attached.
Thanks in advance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This will add the <?xml...> and <UDM...> to the top of each XML file, and a </UDM> at the end, so all of the output is valid XML. It doesn't do any parsing of the XML, just looks for specific records, and splits there. So if your XML is not like you posted, that will make it not work.
It opens the file "file1.xml" for input (you can change this on line 12), and outputs "output#.xml", where the # starts at 1 and counts up. The MaxSize is set to 900MB (base 10). When the output gets that large, it'll split at the next record. If you know the records are going to be small (about 2.8k in your example), you could make this much closer to 1GB. But if you make it 1GB, it'll split at the next record, making the file slightly larger.
Business Accounts
Answer for Membership
by: uaynebPosted on 2009-09-24 at 19:03:31ID: 25419630
And you want to split it so that records do not span over files correct?