25 lines
696 B
Python
25 lines
696 B
Python
import csv
|
|
|
|
input_file = 'controls.csv'
|
|
output_file = 'controls-fix.csv'
|
|
|
|
with open(input_file, mode='r', newline='', encoding='utf-8') as infile:
|
|
reader = csv.DictReader(infile)
|
|
|
|
safeguards = set()
|
|
|
|
for row in reader:
|
|
safeguard = row['CIS v8.1 Safeguards (Sub-Controls)']
|
|
safeguards.add(safeguard)
|
|
|
|
with open(output_file, mode='w', newline='', encoding='utf-8') as outfile:
|
|
fieldnames = ['name']
|
|
writer = csv.DictWriter(outfile, fieldnames=fieldnames)
|
|
|
|
writer.writeheader()
|
|
|
|
for safeguard in safeguards:
|
|
writer.writerow({'name': safeguard})
|
|
|
|
print(f"Conversion completed. The new CSV file is saved as '{output_file}'.")
|