homelab importer funktioniert manuell
This commit is contained in:
18
homelab_importer.ssh
Executable file
18
homelab_importer.ssh
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/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"
|
||||||
0
ssh_manager.sh
Normal file → Executable file
0
ssh_manager.sh
Normal file → Executable file
Reference in New Issue
Block a user