gautam-y / Ansible

Content related to Ansible
0 stars 0 forks source link

Searching #8

Open gautam-y opened 2 months ago

gautam-y commented 2 months ago

#!/bin/bash

# Define the base directory containing the 100 folders
BASE_DIR="/path/to/your/folders"

# Define the output CSV file
OUTPUT_FILE="search_results.csv"

# Write the header to the CSV file
echo "File Path,Status" > "$OUTPUT_FILE"

# Find all files and search for the term "no_log"
find "$BASE_DIR" -type f | while read -r FILE; do
    if grep -q "no_log" "$FILE"; then
        echo "$FILE,Found" >> "$OUTPUT_FILE"
    else
        echo "$FILE,Not Found" >> "$OUTPUT_FILE"
    fi
done