summaryrefslogtreecommitdiff
path: root/postpost/finde_wert
blob: e3dab77642ae90138e0815b4f1fce8b1fde4b054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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