Compare commits
2 Commits
02509c5615
...
4af61e614b
| Author | SHA1 | Date | |
|---|---|---|---|
| 4af61e614b | |||
| a71807d3b6 |
Executable
+28
@@ -0,0 +1,28 @@
|
|||||||
|
#!/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"
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/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"
|
|
||||||
Reference in New Issue
Block a user