29 lines
698 B
Bash
Executable File
29 lines
698 B
Bash
Executable File
#!/bin/bash
|
|
|
|
rm serverliste.csv
|
|
wget http://fileserver.fritz.box/Mobaxterm/Homelab.mxtsessions
|
|
|
|
# Eingabedatei
|
|
INPUT_FILE="Homelab.mxtsessions"
|
|
# Ausgabedatei
|
|
OUTPUT_FILE="serverliste.csv"
|
|
|
|
# Kopfzeile der CSV-Datei
|
|
echo "Name,Adresse / Host" > "$OUTPUT_FILE"
|
|
|
|
# Alle Zeilen in Bookmarks-Abschnitten durchsuchen
|
|
awk '
|
|
/^\[Bookmarks/ { in_section=1; next }
|
|
/^\[/ && !/^\[Bookmarks/ { in_section=0 }
|
|
in_section && /=#109#0%/ {
|
|
split($0, parts, "=")
|
|
name = parts[1]
|
|
split(parts[2], details, "%")
|
|
host = details[2]
|
|
gsub(/.*\\n/, "", name)
|
|
print name "," host
|
|
}
|
|
' "$INPUT_FILE" >> "$OUTPUT_FILE"
|
|
|
|
echo "Export abgeschlossen: $OUTPUT_FILE"
|