summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/update_hosts8
-rwxr-xr-xbin/vimki29
2 files changed, 33 insertions, 4 deletions
diff --git a/bin/update_hosts b/bin/update_hosts
index e7321bf..8550ec3 100755
--- a/bin/update_hosts
+++ b/bin/update_hosts
@@ -13,11 +13,11 @@ echo "last local update: $(date -r /etc/hosts)"
cd /etc
cp -p hosts hosts.old
-hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old)
+hosts=$(awk '/^# Custom host/, /^# End of custom host/' hosts.old)
curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk '
- BEGIN { hosts = ARGV[1]; ARGV[1] = "" }
- /^# Custom host / { print hosts; next }
- /^# End of custom host / { next }
+ BEGIN { hosts = ARGV[1]; ARGV[1] = "" }
+ /^# Custom host/ { print hosts; next }
+ /^# End of custom host/ { next }
{ print }
' "$hosts" > hosts.new
diff --git a/bin/vimki b/bin/vimki
new file mode 100755
index 0000000..50ab6ea
--- /dev/null
+++ b/bin/vimki
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Batch operations on vimki
+
+# rename changes the link name and propagates the change in the wiki
+rename1() {
+ gawk -v old="$1" -v new="$2" -v IGNORECASE=1 '
+ {
+ gsub("[[]" old "[]]", "[" new "]")
+ print
+ }
+ ' "$3"
+}
+
+linkfile() {
+ echo "$1"
+ #echo "$1" | tr '[:upper:] àçéèêëîïôèùûü' '[:lower:]_aceeeeiiouuu'
+}
+
+rename() {
+ for f in *; do
+ rename1 "$1" "$2" "$f" > "$f.$$" && mv "$f.$$" "$f"
+ done
+ oldf="$(linkfile "$1")"
+ [ -f "$oldf" ] && mv "$oldf" "$(linkfile "$2")"
+}
+
+cd ~/Wiki
+"$@"