summaryrefslogtreecommitdiff
path: root/Recipes/remove-styles.sh
blob: 76184179fa8ca263984e1180e37fdf205afec5cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

# Check if the user provided a file
if [[ $# -ne 1 ]]; then
  echo "Usage: $0 <filename>"
  exit 1
fi

# File to process
file="$1"

# Check if the file exists
if [[ ! -f "$file" ]]; then
  echo "Error: File '$file' not found!"
  exit 1
fi

# Use sed to delete everything between <style> and </style>, inclusive
sed ':a; /<style[^>]*>/,/<\/style>/ { /<\/style>/! { N; ba; }; d; }' "$file" >temp_file

# Replace the original file with the modified content
mv temp_file "$file"
echo "Removed <style> contents from $file"