You can make changes to a PostgreSQL database using the command line tool psql. If you have a password needed for the updated you can set the PGPASSWORD environment variable. Example:
PGPASSWORD="mypassword" psql -U username -c database "statement"
If no password is needed, do
psql -U username -c database "statement"
and if no username is needed for the access, you can do
psql -c database "statement"
For the random IPs to change, I would either create an array of all IPs using psql with a
SELECT * FROM ips;
and then create 15 random numbers, use these as index (of course you have to make sure no random number is created twice) and then set them to status removed in the database.
After reading the comments:
To update you could do:
updateIP=`echo ip_string | awk -F' ' '{print $1}'`
psql -U user -c database "UPDATE iptable SET status='status_removed' WHERE ip='${updateIP}';"
To update a single record, given you store the IP in the table "iptable" enter the column "ip" and the status under column "status".