I am wondering if anyone can help me form a Unix RegEx command that will parse a text file. I am familiar with Unix commands, but the regular expression complexity always seems to evade my comprehension.
Here is what I want to do:
Read a text file (see file format below) and load into some javascript arrays. The text file looks like this:
So the end result will be that I will have three arrays. The "Red" text above will be the first element of the arrays, "Blue" will be second, etc. It will look like this:
I realize that I am in need of a lot of help, so I appreciate any advice you can give. I also realize that a small script, or at least a couple of commands will probably be necessary. I am pouring over the man pages now, and scouring the web for examples as you read this.
But if it is simple enough for someone to reply, I would tremendously appreciate it.
Thanks in advance!
Here is what I want to do:
Read a text file (see file format below) and load into some javascript arrays. The text file looks like this:
Code:
A bunch of text that can be ignored is at the top of the file.
Blah blah blah.
----------------------------------------------------------------
Filepath: [COLOR="Red"]/full/path/to/a/filename.ext[/COLOR]
Filename: [COLOR="red"]filename[/COLOR]
Title: filename [COLOR="red"]"Some Title"[/COLOR]
File Contents:
A bunch of other stuff I can igore.
----------------------------------------------------------------
Filepath: [COLOR="Blue"]/full/path/to/a/filename2.ext[/COLOR]
Filename: [COLOR="Blue"]filename2[/COLOR]
Title: filename [COLOR="Blue"]"Some Other Title"[/COLOR]
File Contents:
A bunch of other stuff I can igore.
So the end result will be that I will have three arrays. The "Red" text above will be the first element of the arrays, "Blue" will be second, etc. It will look like this:
Code:
array1[0] = /full/path/to/a/filename.ext;
array1[1] = /full/path/to/a/filename2.ext;
array2[0] = filename;
array2[1] = filename2;
array3[0] = "Some Title"
array3[1] = "Some Other Title"
I realize that I am in need of a lot of help, so I appreciate any advice you can give. I also realize that a small script, or at least a couple of commands will probably be necessary. I am pouring over the man pages now, and scouring the web for examples as you read this.
But if it is simple enough for someone to reply, I would tremendously appreciate it.
Thanks in advance!