check.sh 546 Bytes
LINE=1

while IFS= read -r ID
do
    if [ $(echo $ID | cut -c1-1 | grep [0-9]) ]
    then
        STATUS=$(curl -d "id=$ID" 192.168.15.75:5000/cons)
        if [[ $STATUS != "queued" ]]
        then
            echo $LINE >> delete
        fi
    else
        echo $LINE >> delete
    fi
    LINE=$(($LINE+1))
done < msg_ids.txt

if [ -e delete ]
then
    tac delete > aux
    cat aux > delete

    while IFS= read -r LINE
    do
        sed ${LINE}d msg_ids.txt > aux
        cat aux > msg_ids.txt
    done < delete

    rm delete
    rm aux
fi