I have the following bash script:
#!/bin/bash
KEY=$(./get-aws-profile.sh --profile=$1 --key)
SECRET=$(./get-aws-profile.sh --profile=$1 --secret)
ES="https://search-****.eu-west-1.es.amazonaws.com"
INDEXES=$(AWS_ACCESS_KEY_ID="$KEY" AWS_SECRET_ACCESS_KEY="$SECRET" aws-es-curl $ES/_cat/indices | awk '{print $3}')
YESTERDAY=$(date --date="yesterday" +"%Y.%m.%d")
for i in $INDEXES
do
# $i is like report-processing-2019.10.10
if grep "$YESTERDAY" $i; then
echo "Pulling documents from $i to $i.ndjson"
echo "docker run -it blaze blaze --host=$ES --index=$i --insecure > /tmp/$i.ndjson"
echo "Index $i saved"
else
echo no
fi
done
exit 0
where $i
is like report-processing-2019.10.10
when i run this, i am not able to get the the lines which contain only lines with 2019.10.10 in them, what am i missing?
any advice is much appreciated