#!/bin/bash # Path to the file file="$IAS_ORACLE_HOME/instances/EBS_web_OHS1/config/OHS/EBS_web_OAQCTSUP/mod_wl_ohs.conf" # Grep for "sup" in the file output=$(grep "sup" "$file") # Email subject and body subject="Grep Results for 'sup'" body="The following lines contain 'sup' in the file $file:\n\n$output" # Encode the output using uuencode encoded=$(echo "$body" | uuencode output.txt) # Send email with encoded output as attachment echo -e "Please find attached the output of the script." | mailx -s "$subject" [email protected] <<< "$encoded" # Remove encoded file rm output.txt
No comments:
Post a Comment