Multiple variable substitution in a file in one go

I have a huge script which is defining variables with full path of commands in the beginning of code and using those variables in the script.

For Example:

ECHO=/bin/echo
LS=/bin/ls
SED=/bin/sed
AWK=/bin/awk
UNAME=/bin/uname
PS=/bin/ps
DATE=/bin/date
GREP=/bin/grep


$ECHO "hello world"
$LS -ltr|$AWK '{print $NF}'
$SED 's/$.//g'
$UNAME -r
$UNAME -m
$HOSTNAME
$PS -ef|$GREP ora|$GREP -v grep
$DATE +%Y%M%D

Now i want replace all these variable with absolute path of the commands in one go.

Can you guys please help me with this.

Regards,
Veer

Is this a homework assignment?

You haven't specified nearly enough to know what should be done here. And, some requirements could make this an extremely complex job requiring a full syntactic and semantic understanding of the shell you're using and of all of the commands invoked by your script.

  1. What delimits the start and end of the variable assignments to be removed and expanded by your script?
  2. Are occurrences of expansions of these variables to be replaced inside pairs of single quotes?
  3. Does your script need to be smart enough not to replace $ECHO in the command: $LS $ECHO_OLD ?
  4. Does your script need to be smart enough to replace ${ECHO} as well as $ECHO ?
  5. Is your script to search out and replace these variables in dotted and sourced files?
  6. What if a script creates an intermediate encoding that result in one of these variables being expanded as a side effect of running eval ?
  7. What if a printf invocation leads to a string being put into a variable that will be expanded and run later in the script?

What have you tried? With what you have tried, what isn't working?