File: //opt/trading-bot/remove_duplicates.sh
#!/bin/bash
# Remove duplicate Alpha tab sections
cd /opt/trading-bot/static
# Backup
cp index.html index.html.backup3
# Count how many times the alpha tab appears
COUNT=$(grep -c '<div id="alpha" class="tab-content">' index.html)
echo "Found $COUNT Alpha tab sections"
if [ "$COUNT" -gt 1 ]; then
# Keep only the first occurrence, delete the rest
# This is tricky - we'll use awk to keep only the first match
awk '
/<div id="alpha" class="tab-content">/ {
if (count == 0) {
print
in_alpha = 1
count++
} else {
skip = 1
}
next
}
/<div id="scalper" class="tab-content">/ {
if (skip == 1) {
skip = 0
}
in_alpha = 0
print
next
}
{
if (skip == 0) {
print
}
}
' index.html > index.html.tmp
mv index.html.tmp index.html
echo "Removed duplicate Alpha tabs"
else
echo "No duplicates found"
fi
# Verify
FINAL_COUNT=$(grep -c '<div id="alpha" class="tab-content">' index.html)
echo "Final count: $FINAL_COUNT Alpha tab sections"