blob: 4044fe9db73090b079dec9c9a6ebdb7523c3c5cd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/bash
# Check if a file was provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 [file]"
exit 1
fi
# File to be processed
FILE="$1"
# Check if the file exists
if [ ! -f "$FILE" ]; then
echo "Error: File not found."
exit 1
fi
# Create a backup of the original file
cp "$FILE" "$FILE.bak"
# Replace special characters within <description> tags using sed
sed -i '/^<description>/,/<\/description>/ s/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g' "$FILE"
echo "Processing complete. Original file backed up as $FILE.bak"
|