I'm a complete noob at awk/sed so forgive me if I'm missing something obvious here.
Basically I'm trying to do a nested grep, i.e. something akin to:
grep $value `exim -Mvh $(`exim -bpru | grep $eximID | more`)`
Breakdown:
grep $value IN COMMAND 
--> exim -Mvh (print exim mail headers) FROM RESULTS OF 
    ---> exim -bpru | grep $eximID | more
- $valueis the string I'm looking for
- $eximIDis the string I'm looking for within exim -bpru (list all exim thingies)
No idea if what I'm trying to accomplish would be easier with awk/sed hence the question really.
I tried to make that as legible as possible but nested nesting is hard yo
Edit Tada! My script is now workings thanks to you guys! Here it is, unfinished, but working:
#!/usr/bin/bash
    echo "Enter the email address you want to search for + compare sender info via exim IDs."
    read searchTarget
    echo "Enter the target domain the email is coming from."
    read searchDomain
    #domanList is array for list of exim IDs needed
    domainList=($(exim -bpru | grep "$searchDomain" | awk '{ print $3 }'))
    for i in "${domainList[@]}"
            do
                    echo "$(exim -Mvh  $i | grep $searchTarget)"
                    #echo "$(grep $searchTarget $(exim -Mvh $i))"
            done
 
     
     
    