Skip to content

Instantly share code, notes, and snippets.

@lionslair
Last active March 21, 2024 01:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lionslair/b867e95aad4703e9cd1333dbe3f36024 to your computer and use it in GitHub Desktop.
Save lionslair/b867e95aad4703e9cd1333dbe3f36024 to your computer and use it in GitHub Desktop.
Remove the pulse inserts from sql script
#!/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' "$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