Soldato
- Joined
- 24 Nov 2002
- Posts
- 16,378
- Location
- 38.744281°N 104.846806°W
I have the folllowing type of data in a 10mb flat file database:
Note that each 'set' of these may have any number of fields but all start with [Term] and have a unique ID on the next line.
I want to, in php preferably, be able to load up the text file and 'sort' the contents into three seperate files based upon the value of the *namespace* field (i.e. a, b and c). This sounds simple enough but I'm stumped.
The methods I've used before rely on the fields all being on one line and having no headings so I'm mightily confused!
Any pointers?
Code:
[Term]
id: 1
name: blah
namespace: a
def: blah
[Term]
id: 2
name: blah2
namespace: b
def: blah2
[Term]
id: 3
name: blah3
namespace: c
def: blah3
[Term]
id: 4
name: blah4
namespace: a
def: blah4
... so on....
Note that each 'set' of these may have any number of fields but all start with [Term] and have a unique ID on the next line.
I want to, in php preferably, be able to load up the text file and 'sort' the contents into three seperate files based upon the value of the *namespace* field (i.e. a, b and c). This sounds simple enough but I'm stumped.
The methods I've used before rely on the fields all being on one line and having no headings so I'm mightily confused!
Any pointers?