Hi,
have to write a script; on the command line, it's (as one-liner):
Code:
time while read line; do echo -n "$line "; grep -P -m 1 "\t[A-Z]$line" logfile |wc -l; done < <(tail db.txt)
The time is only for debugging as is the tail and the script works
If I put it in a file
Code:
while read line;
do
echo -n "$line ";
grep -P -m 1 "\t[A-Z]$line" logfile |wc -l;
done < <(tail db.txt)
and execute with sh verify.sh, it complains about the last line
Code:
wim@btd-techweb01:~/log$ sh verify.sh
verify.sh: line 5: syntax error near unexpected token `<'
verify.sh: line 5: `done < <(tail db.txt)'
Can someone explain to me why ? I assume that the input redirection has to be outside the file, but it does not explain the why.
If I add '#!/bin/bash' at the beginning of verify.sh and make it executable, it works (again) as expected.
Note:
I will probably post some more questions as it needs some serious optimisation and a slight modification.