#!/bin/bash
rm commands.sql -v
# File to read
file="dump.txt"

# Counter for line number
line_number=1

# Read each line of the file
while IFS= read -r line; do
    # Store the line in a variable
    variable_name="line_$line_number"
    declare "$variable_name"="$line"

    # Increment the line number counter
    ((line_number++))
done < "$file"

# Print the variables to verify
for ((i=1; i<line_number; i++)); do
    var="line_$i"
    date=$(date +%s)
    echo "INSERT INTO \"main\".\"todo\"(\"ID\",\"TODO\",\"CREATION_DATE\",\"DUE_DATE\",\"PRIO\",\"IMP\") VALUES (NULL,'${!var}','$date','$(($date+60))',1,0);" >> commands.sql
done
echo converted $file to sql statements
