I have the following long one liner which essentially provides a list of PIDs with a '|' delim character
echo $(lsof -p $(pgrep -f dosemu | tr '\012' ,) | grep '/media/datadrv' | awk '{print $2" - " $9}' | grep 'DBASE1.RES' | awk '{print $1}') | sed 's/\s\+/|/g'
this output something similar to 19066|19500
What I want to do is use this to feed into the pstree command using egrep.
for example the following command gives me what i need
pstree -p | egrep '19066|19500'
What I cant figure out is how to feed the results of the first command into the second.
Update Thanks to Goro's answer the complete one liner was :-
pstree -p | egrep $(echo $(lsof -p $(pgrep -f dosemu | tr '\012' ,) | grep '/media/datadrv' | awk '{print $2" - " $9}' | grep 'DBASE1.RES' | awk '{print $1}') | sed 's/\s\+/|/g')