Shell script to replace output of command

Hi

I would like to write a shell script which replace particular text in output of a shell command. For example : If I execute pwd (if dir is /users/master/) it should display as - /users/Master_directory/.

Also, for generalising the script I would like to receive parameters when I run the shell script.

Help will be appreciated.

Thanks
Ratnesh

Post how you want to run the script..do you want something like this ?

bash# ./replace.sh "pwd" "master" "Master_directory"

Below is rough outline :

  1. Call script with few parameters like " -firstparam One -secondparam Two"

  2. In script execute a unix command lets say "cat example.txt". Original output is -
    This is line number 1
    This is line number 2

  3. Replace data in output -
    1 is replaced by One and 2 by Two

  4. Displays final output -
    This is line number One
    This is line number Two

I hope I am clear enough

And what have you done so far?