Skip to content

Instantly share code, notes, and snippets.

@djkonro
Last active November 19, 2017 22:09
Show Gist options
  • Save djkonro/c4269bf71b300439d41cf7ff01efa25c to your computer and use it in GitHub Desktop.
Save djkonro/c4269bf71b300439d41cf7ff01efa25c to your computer and use it in GitHub Desktop.
f = open("/home/konrad/Desktop/grep_output_file.txt","r")
data = f.read()
key = '[Feature:'
start = 0
end = len(key)
val = ''
l = []
for i in range(len(data)):
if start == end:
if data[i] != ']':
if data[i] != '(' and data[i] != ')':
val = val+data[i]
continue
else:
start = 0
if '.+' not in val and val not in l:
l.append(val)
val = ''
if key[start] == data[i]:
start = start+1
continue
else:
start = 0
tmp = []
n = len(l)
i = 0
while i < n:
if '|' in l[i]:
tmp = tmp + l[i].split('|')
l.remove(l[i])
n = len(l)
i = i+1
for i in range(len(tmp)):
if tmp[i] not in l:
l.append(tmp[i])
l.sort()
print(l)
@djkonro
Copy link
Author

djkonro commented Nov 19, 2017

[output]:

['%s', 'AppArmor', 'Audit', 'BootstrapTokens', 'ClusterAutoscalerScalability1', 'ClusterAutoscalerScalability2', 'ClusterAutoscalerScalability3', 'ClusterAutoscalerScalability4', 'ClusterAutoscalerScalability5', 'ClusterAutoscalerScalability6', 'ClusterDowngrade', 'ClusterSizeAutoscalingScaleDown', 'ClusterSizeAutoscalingScaleUp', 'ClusterSizeAutoscalingScaleWithNAP', 'ClusterUpgrade', 'ComprehensiveNamespaceDraining', 'CustomMetricsAutoscaling', 'Docker', 'Downgrade', 'DynamicKubeletConfig', 'Elasticsearch', 'Empty', 'EtcdUpgrade', 'Example', 'ExperimentalResourceUsageTracking', 'FSGroup', 'FlexVolume', 'GCEAlphaFeature', 'GKEEnv', 'GKELocalSSD', 'GKENodePool', 'GPU', 'GPUDevicePlugin', 'HAMaster', 'Ingress', 'Initializers', 'KubeProxyDaemonSetDowngrade', 'KubeProxyDaemonSetMigration', 'KubeProxyDaemonSetUpgrade', 'LabelSelector', 'LocalPersistentVolumes', 'LocalStorageCapacityIsolation', 'MasterUpgrade', 'NEG', 'NetworkPolicy', 'Networking-IPv4', 'Networking-IPv6', 'Networking-Performance', 'NoSNAT', 'NodeAuthorizer', 'NodeUpgrade', 'OpaqueResources', 'Performance', 'PodGarbageCollector', 'PodPreemption', 'PodPreset', 'Reboot', 'ReclaimPolicy', 'Seccomp', 'SecurityContext', 'ServiceLoadBalancer', 'StackdriverCustomMetrics', 'StackdriverLogging', 'StackdriverMonitoring', 'StatefulSet', 'StatefulUpgrade', 'TaintEviction', 'Upgrade', 'Volumes', 'vsphere']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment