I'm trying to get info from log files using grep + tail -1:
#!/bin/bash
# declare an array called array and define 3 vales
array=( 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 )
array2=( 00 30 )
for i in "${array[@]}"
do
for j in "${array2[@]}"
do
output=$(grep filtered /home/pavel/hasoffers_api/logs/tabatoo2_20180627$i$j* | tail -1)
echo /home/pavel/hasoffers_api/logs/tabatoo2_20180627$i$j*
echo "$output"
done
done
this outputs just empty string, but I definitely know that phrase "filtered" is in the logs.
What can be the problem? I tried several variations of the same script but it just returns empty string.
Thanks!