summaryrefslogtreecommitdiffstats
path: root/bin/import-statements
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-05-21 01:56:08 +0200
committertv <tv@shackspace.de>2015-05-21 01:56:08 +0200
commit36670f3e1cccad579b994a29320eeb8e287803b7 (patch)
tree484cb2c1075cdcabe8020ca40704f4d68f2b2fed /bin/import-statements
parentb95a514bcced00af77ae4adab77326dba9ab4c36 (diff)
sh: functions -> bin/
Diffstat (limited to 'bin/import-statements')
-rwxr-xr-xbin/import-statements10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/import-statements b/bin/import-statements
new file mode 100755
index 000000000..12c887970
--- /dev/null
+++ b/bin/import-statements
@@ -0,0 +1,10 @@
+#! /bin/sh
+# import-statements : lines (path ":" string) |> lines (path ":" relpath)
+set -euf
+sed -n '
+ s@^\([^:]\+:\)\('"$(bre-invert-word import)"'\)*\<import\s\+@\1@
+ t1;d
+ :1; s@^\([^:]\+:\)\(\.*/\S*\)@\1\2\n@
+ t2;d
+ :2; P;D
+'