From 93f452556fd562c6b69f756b11f2fd3eb21e4cee Mon Sep 17 00:00:00 2001
From: Daniel Porzucek <danpor@st.amu.edu.pl>
Date: Wed, 20 Mar 2024 17:20:48 +0100
Subject: [PATCH] added cutoff script

---
 Jenkinsfile      |  2 +-
 data_download.sh | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 3555c2d..db3fea9 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -25,7 +25,7 @@ pipeline {
           withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
                         "KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
                   sh 'chmod 777 ./data_download.sh'
-                  sh './data_download.sh'
+                  sh './data_download.sh --cutoff \"${params.CUTOFF}\"'
               }
         }
       }
diff --git a/data_download.sh b/data_download.sh
index 5f096a1..a5efbfe 100644
--- a/data_download.sh
+++ b/data_download.sh
@@ -10,3 +10,20 @@ 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"
+cutoff="10"
+shift "$(($OPTIND - 1))"
+if [[ "$1" == "--cutoff" ]]; then
+  shift
+  if [[ ! "$1" =~ ^[0-9]+$ ]]; then
+    echo "Error: cutoff value must be a positive number"
+    exit 1
+  fi
+  cutoff="$1"
+fi
+
+head -n "$cutoff" train.csv > cutoff_train.csv
+
+figlet "DISPLAY CUTOFF DATA"
+cat cutoff_train.csv