M
M
MarvinD2019-10-23 23:34:32
Parsing
MarvinD, 2019-10-23 23:34:32

How to parse multiple text files to CSV (excel)?

There are a lot of standardized emails (I can save them with the same thunderbird in separate eml files). It is necessary to tear out data from the contents of these files by the mask "full name:", "email:" and put it into one file, excel is better, but in fact cvs is not bad either. This is how I dealt with php before (the parser made a simple one, in general I imagine what it is), but here it is necessary that there is a local program. I already thought about remembering the university and compiling a c++ binary for Windows, but for now I'll keep my head down ... Maybe there are ready-made tools in general to tear out the necessary data from an array of text files? Type to select a directory of source codes, to specify a mask on which to tear out the data - and voila. I don't really want to reinvent the wheel.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MarvinD, 2019-10-24
@MarvinD

Frets, I don’t bother anyone, I put c ++ in netbeans, digging from old memory, like:

regex maskStr("^<strong>.*");
...
while (getline (inFile,line)) {
        if ( regex_match(line, maskStr) ) {
            sum = sum + x;
            cout << line << '\n';
        }
}

It seems to plow, it remains to go through the directory in the cycle and write it to cvs. To be honest, I didn’t think that a modern IDE could do everything so nicely. Now both php and c++ are in one bottle. Thanks, NetBeans :)
PS: I even installed VS2019 out of fear :) but everything compiles well in NetBeans. Let's see how it goes on other computers, I hope the exe and text files will be enough to transfer.

X
xmoonlight, 2019-10-23
@xmoonlight

1. https://www.powergrep.com/manual.html#xmpcsv
2. https://github.com/retnek/emlextractor (PHP)

V
Vladimir Kuts, 2019-10-23
@fox_12

man grep
man awk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question