From 77899abc321b4ae928f62c3e00b7ed892ec1ff4c Mon Sep 17 00:00:00 2001
From: sak2n21 <sak2n21@soton.ac.uk>
Date: Wed, 3 May 2023 17:11:26 +0800
Subject: [PATCH] (Commit Message) Script file for grep data

---
 data.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100755 data.sh

diff --git a/data.sh b/data.sh
new file mode 100755
index 0000000..5376f3a
--- /dev/null
+++ b/data.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+curl https://www.kitco.com/charts/livegold.html > data.html
+goldprice=$(cat data.html | grep "sp-bid" | sed 's/[^$.0-9]*//g')
+
+curl https://www.kitco.com/charts/livesilver.html > data2.html
+silverprice=$(cat data2.html | grep "sp-bid" | sed 's/[^$.0-9]*//g')
+
+curl https://www.kitco.com/charts/livepalladium.html > data3.html
+palladiumprice=$(cat data3.html | grep "sp-bid" | sed 's/[^$.0-9]*//g')
+
+curl https://www.kitco.com/charts/liveplatinum.html > data4.html
+platinumprice=$(cat data4.html | grep "sp-bid" | sed 's/[^$.0-9]*//g')
+
+date=$(date +%d-%m-%Y)
+time=$(date "+%H-%M %p")
+
+echo "GoldPrice:$goldprice, SilverPrice:$silverprice, PalladiumPrice:$palladiumprice, PlatinumPrice:$platinumprice, DateTime: $date $time" >>data.txt
-- 
GitLab