From: josuer08 Date: Mon, 21 Oct 2019 20:46:15 +0000 (-0400) Subject: added cleaner and precompiler X-Git-Url: https://git.josue.xyz/?a=commitdiff_plain;h=023012b025db1c4a62fc799e7c8dfe9bdae362d3;p=vsorcdistro%2F.git added cleaner and precompiler --- diff --git a/cleaner.sh b/cleaner.sh new file mode 100644 index 0000000..c19f589 --- /dev/null +++ b/cleaner.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cat $1 | grep -E "[sh]+[0-9]{1,3}:[sh]+[0-9]{1,3}" > $1_clean +cat $1 | grep -vE "[sh]+[0-9]{1,3}:[sh]+[0-9]{1,3}" > $1_dirt + diff --git a/precompiler.py b/precompiler.py new file mode 100644 index 0000000..2e2cf56 --- /dev/null +++ b/precompiler.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +import sys +import os +import time +cmd = './cleaner.sh '+sys.argv[1] +os.system(cmd) +time.sleep(.300) +document = open(sys.argv[1] + "_clean" ,"r+") +links = document.readlines() +document.close + +#clean the \n in the colected data +a = 0 +for linkline in links: + links[a] = linkline.rstrip() + a+=1 + +# get a list of non repeating devices +devices = [] +for value in links: + value_split = value.split(':') + devices.append(value_split[0]) + devices.append(value_split[1]) +devices = list(dict.fromkeys(devices)) +print devices +print links