Unix programming scripts.

How can I replace "?" with the appropriate information.

Actual File:
cat /tmp/question
What is the correct answer??
Replace th?s
??
Hello Boss? ???
?? hell ??

This is substitue ' ! ' in all occurrences of ' ? '.
sed 's/?/!/g' /tmp/question

After replacement:
What is the correct answer!!
Replace th!s
!!
Hello Boss! !!!
!! hell !!

Please let us know if this works..

Thanks
Nagaraj G

in Perl:

$ perl -pi -e 's/\?/!/g' filename

replace all occurances of ? with ! in filename

an alternate way with awk could be:

echo "HELLO? HOW ARE YOU?" | awk '{ gsub(/\?/, "\|");     print $0; }'

output:

Hi ennstate,

from you thread:

sed 's/?/!/g' /tmp/question

can you explain what mean "s" and "g" and thereis any other alphabet that using in sed command?
thank you

Regards,

heru

Thank you for your answer guys, I really appreciate it.

s is search and replace; g is global, i.e., replace all occurrences of the search pattern instead of only replacing the first.

There are many other commands; read the man page for more information, or go to one of the on-line resources listed on my shell links page: http://cfaj.freeshell.org/shell/resources.shtml

Thankyou very much cfajohnson for your web link , I will study from your web page.

Regards,

heru