summaryrefslogtreecommitdiff
path: root/postpost/finde_wert
diff options
context:
space:
mode:
Diffstat (limited to 'postpost/finde_wert')
-rwxr-xr-xpostpost/finde_wert15
1 files changed, 15 insertions, 0 deletions
diff --git a/postpost/finde_wert b/postpost/finde_wert
new file mode 100755
index 0000000..e3dab77
--- /dev/null
+++ b/postpost/finde_wert
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+alles=$(cat "$1" | wc -l)
+
+for i in $(grep -n "^&$2\( \|$\)" "$1" | tr ":" " " | awk '{ print $1; }')
+do
+ k=$((tail -n$[$alles-$i] $1; echo "&") | grep -n "^&" | head -n1 | tr ":" " " | awk '{ print $1; }')
+ for j in $(tail -n$[$alles-$i+1] $1 | head -n$k | grep -n "^ *$3\( \|$\)" | tr ":" " " | awk '{ print $1; }')
+ do
+ echo $[$j+$i-1]
+ exit
+ done
+done
+
+echo 0