#!/bin/bash
figlet "DOWNLOAD DATA"
kaggle datasets download iabhishekofficial/mobile-price-classification --unzip --force


figlet "TESTSET BEFORE ID COLUMN CUT"
head -n 5 test.csv
cut -d',' -f2- test.csv > test_without_id_column.csv


figlet "TESTSET AFTER ID COLUMN CUT"
head -n 5 test_without_id_column.csv

figlet "CUTOFF DATA FROM TRAIN SET"
shift "$(($OPTIND - 1))"
if [[ "$1" == "--cutoff" ]]; then
  shift
  echo "$1"
  if [[ ! "$1" =~ ^[1-9][0-9]*$ ]]; then
    echo "Error: cutoff value must be a positive number"
    exit 1 
  fi
  cutoff=$(("$1" + 1))
  echo "CUTOFF $cutoff"
fi

head -n "$cutoff" train.csv > cutoff_train.csv

figlet "DISPLAY CUTOFF DATA"
cat cutoff_train.csv