diff options
author | simulation <simulation@nlo-ext3.ioq.uni-jena.de> | 2016-02-09 09:54:46 +0100 |
---|---|---|
committer | simulation <simulation@nlo-ext3.ioq.uni-jena.de> | 2016-02-09 09:54:46 +0100 |
commit | 6be0f285adb27f60f058c2937a7885899e17cb88 (patch) | |
tree | be50a15314fe28c5b7b8f721233a34e71ca5b3b4 /postpost/finde_wert | |
download | lpic-master.tar.xz |
Diffstat (limited to 'postpost/finde_wert')
-rwxr-xr-x | postpost/finde_wert | 15 |
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 |