aboutsummaryrefslogtreecommitdiff
path: root/bin/slsf.awk
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-16 19:54:57 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-16 19:57:58 +1200
commit481f4fa397bbdadcba7d7e6f93f3e058268a95b2 (patch)
tree7c01924feb4f58c038c9f05dabea00f85314116b /bin/slsf.awk
parentRemove .m4 from suffixes (diff)
downloaddotfiles-481f4fa397bbdadcba7d7e6f93f3e058268a95b2.tar.gz
dotfiles-481f4fa397bbdadcba7d7e6f93f3e058268a95b2.zip
Move awk scripts into shb(1)
Diffstat (limited to 'bin/slsf.awk')
-rw-r--r--bin/slsf.awk10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/slsf.awk b/bin/slsf.awk
new file mode 100644
index 00000000..9d12225d
--- /dev/null
+++ b/bin/slsf.awk
@@ -0,0 +1,10 @@
+# Print the first non-glob "Host" name from each line of ssh_config(5) files
+
+# Manage the processing flag (starts set in each file)
+FNR == 1 || /### sls/ { sls = 1 }
+/### nosls/ { sls = 0 }
+
+# If processing flag set, directive is "Host", and hostname has no wildcards,
+# then print it
+!sls { next }
+$1 == "Host" && $2 !~ /\*/ { print $2 }