<jupyter_start><jupyter_text>Parse the cooja log output to corret CSV<jupyter_code>import os
import sys
logDir = "./logs-rpl//"
for root, subdirs, files in os.walk(logDir):
    if len(files) > 0:
        toConvertFiles = [f for f in files if "rpl-101-" in f and "log" in f]
        print toConvertFiles   
        print root
        print subdirs
        print files
        for fname in toConvertFiles:
            with open("/".join([root, fname]), "r") as f:
                lines = f.readlines()
                lines = lines[1:-2]
                with open("/".join([root, fname[:-3]])+"csv", "w") as out_f:
                    for l in lines:
                        out_f.write(l)
            os.remove("/".join([root, fname]))
        
        print "\n\n"
    else:
        continue<jupyter_output>['rpl-101-3.log', 'rpl-101-5.log', 'rpl-101-4.log', 'rpl-101-3 (copy).log', 'rpl-101-4 (copy).log']
./logs-rpl//mod/logs-mod-mob-traces-12
[]
['rpl-101-3.log', 'rpl-101-5.log', 'rpl-101-4.log', 'RUN_REPEATED_LAST.log', 'rpl-101.cooja_log', 'rpl-101-3 (copy).log', 'rpl-101-4 (copy).log']



['rpl-101-2 (another copy).log', 'rpl-101-2 (3rd copy).log', 'rpl-101-2 (4th copy).log', 'rpl-101-2.log', 'rpl-101-2 (copy).log']
./logs-rpl//mod/logs-mod-mob-traces-1
[]
['rpl-101-2 (another copy).log', 'rpl-101-2 (3rd copy).log', 'rpl-101-2 (4th copy).log', 'rpl-101-2.log', 'RUN_REPEATED_LAST.log', 'rpl-101-2 (copy).log', 'rpl-101.cooja_log']



['rpl-101-3.log', 'rpl-101-5.log', 'rpl-101-2.log', 'rpl-101-4.log', 'rpl-101-1.log']
./logs-rpl//mod/logs-mod-mob-traces-13
[]
['rpl-101-3.log', 'rpl-101-5.log', 'rpl-101-2.log', 'rpl-101-4.log', 'RUN_REPEATED_LAST.log', 'rpl-101.cooja_log', 'rpl-101-1.log']



['rpl-101-2 (another copy).log', 'rpl-101-2 (3rd copy).log', 'rpl-101-2 (4th copy).log', 'rpl-10[...]
{'fraction_non_alphanumeric': 0.2251655629139073, 'fraction_numerical': 0.08885209713024282, 'mean_word_length': 2.4798464491362764, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '447210', 'license': 'MIT', 'n_tokens_mistral': 876, 'n_tokens_neox': 781, 'n_words': 141, 'path': 'assets/files/papers/15/mswin-2017/mswim-2017-plots/plots/log2csv.ipynb', 'repo_name': 'bps90/bps90.github.io', 'size': '1812'}