Home » Questions » Computers [ Ask a new question ]

"Syntax" Highlight a flatfile

"Syntax" Highlight a flatfile

I've googled and looked and explored, but it seems most editors configurable syntax highlighting definitions are based on keywords and such. I need one that is based on columns and lines, basically something to highlight different fields in a flat file.

Asked by: Guest | Views: 52
Total answers/comments: 5
Guest [Entry]

"You could look at the RecordEditor RecordEditor it is not a Text editor (it displays the data in a table). It also has single record display + other views available.

The default is to select the record layout but the there is a ""prefered layout"" which will display each record using the correct layout for the record.

It does allow you to visually check the file

With the RecordEditor you can display the file in a table (following with prefered option

you can also display in a highlighted text view (View >>>> Text View (Highlight Fields))

you can also mix-match, here the current record is also displayed in table format on the right hand side:

Alternatively the RecordEditor has macro option. You could

Use the built in macros ViewForEachRecordType.js or HeaderDetailFooterTabs.js (missing from some versions) to display each record type on a seperate Tab
Write your own (possibly adapted from ViewForEachRecordType.js)

Running ViewForEachRecordType.js

This will generate a seperate Tab for each record type in the File:

Another possibility could be Textplorer, I have not tried it myself but it looks like it will highlight fields"
Guest [Entry]

"Vim! Start with there instructions for changing syntax highlighting and make your way from there. Here's what I think you're saying:

If a line starts with ""A"" it will have a series of 12 characters; a space; six chars; some spaces; many chars
If a line starts with ""B"" it will have a series 14 chars;
If a line starts with ""C"" it will have 4 chars; some spaces; 4 chars

So you can definitely define your highlighting rules based on those requirements."
Guest [Entry]

"If I wasn't going to code a front-end for the file, I would probably use Notepad++ as it has a way to define your own language, complete with highlighting.

Download / Main site

All about the user-defined language section

Another example / walkthru

Hopefully these will help you get started."
Guest [Entry]

"It looks like your columns are space delimited?

Have you tried just importing them into Excel, and then just applying highlighting/colours to the columns?

If that won't cut it then as others say, you're probably looking at programming. You could probably write a fairly simple Perl or VBScript that'll take that text file and output a syntax highlighted HTML file or similar using something like regexes to match the patterns that you're looking for?"
Guest [Entry]

You could try something like Monarch