Last active
June 4, 2024 02:16
-
-
Save lionslair/b867e95aad4703e9cd1333dbe3f36024 to your computer and use it in GitHub Desktop.
Remove the pulse inserts from sql script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if the script received an argument | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 <sql_file>" | |
exit 1 | |
fi | |
# Check if the file exists | |
if [ ! -f "$1" ]; then | |
echo "File not found!" | |
exit 1 | |
fi | |
# Remove the insert statements | |
sed -i.bak -e '/INSERT INTO `pulse_aggregates`/d' -e '/INSERT INTO `pulse_entries`/d' -e '/INSERT INTO `pulse_values`/d' -e '/INSERT INTO `failed_jobs`/d' -e '/INSERT INTO `xero_tokens`/d' -e '/INSERT INTO `daily_task_statuses`/d' -e '/INSERT INTO `logs`/d' -e '/INSERT INTO `app_logs`/d' "$1" | |
echo "Operation completed. The original file was backed up with a .bak extension." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment