#!/bin/bash
# Replace <directory_path> with the actual path of your Apache directory
DIRECTORY=<directory_path>
# Loop through each file in the directory
for file in $DIRECTORY/*; do
# Use curl to fetch the headers of each file and grep for TEXT
headers=$(curl -I -s "$file" | grep -i "TEXT")
# If TEXT is found, print the file name and the header
if [[ $headers ]]; then
echo "TEXT found in $file:"
echo $headers
echo ""
fi
done
This script uses curl to fetch the headers of each file in the specified directory and then uses grep to search for the TEXT. If the Text is found, the script prints the file name and the header.
To use the script, save it to a file (e.g., find_text.sh), make it executable (chmod +x find_text.sh), and then run it (./find_text.sh). Make sure to replace <directory_path> with the actual path of your directory.