19 lines
482 B
Bash
Executable File
19 lines
482 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Eingabedatei
|
|
INPUT_FILE="Homelab.mxtsessions"
|
|
# Ausgabedatei
|
|
OUTPUT_FILE="serverliste.csv"
|
|
|
|
# Kopfzeile der CSV schreiben
|
|
echo "Name,Adresse / Host" > "$OUTPUT_FILE"
|
|
|
|
# Daten extrahieren und formatieren
|
|
grep -oP '^[^=]+=#109#0%[^%]+' "$INPUT_FILE" | while IFS= read -r line; do
|
|
name=$(echo "$line" | cut -d'=' -f1 | sed 's/.*\\n//')
|
|
host=$(echo "$line" | cut -d'%' -f2)
|
|
echo "$name,$host" >> "$OUTPUT_FILE"
|
|
done
|
|
|
|
echo "Export abgeschlossen: $OUTPUT_FILE"
|