Storing a file as an array of lines

I am considering using IPFS as the data layer for an application that uses two existing file formats, both line-based. I would like to be able to run analysis on the files, e.g. how many lines begin with character x.

I would like to emulate a folder structure, with lines being the lowest level, such as

Folder1
    File1.ff1
        line1
        line2 
        line3 
        ...
    File1.ff2
        line1
        line2 
        line3 
        ...
Folder2
    File2.ff1
        line1
        line2 
        line3 
        ...
    File2.ff2
        line1
        line2 
        line3 
        ...
   ...

Can any recommend a way to store this in IPFS?
I was originally planning a JSON type structure with a DAG, and translating the files I want to store, but that would require creating a new data format, which might be good to avoid.

Looks pretty much like flat file text to me. I must be missing something.

If I understood well, you can translate it to ipld-cbor (which is json) and make a dag with that. Easily usable with ipfs dag put. You’d have objects like:

{ "name": "line1" }
{ "name": "File1.ff1", "lines": [ { "/": <line-obj-cid>},...] }
{ "name": "Folder1", "files": [ { "/": <file-obj-cid},...] }

Yes it is basically flat file text!

I’m just wondering if there is a better way to store text files that might lend itself better to querying/processing. It looks like at some point we should have an IPLD query language, so perhaps a JSON data structure as @hector suggests would be a better way to go.