It does nothing

I was running this sed -e 's/D/walter/g' CD* command to replace D with walter in all files that starts with CD,

It executes but D is not replaced

txs fwd

Are you get any error messages?

Are you sure you are in the correct directory containing the file CD*?

Ya I'm in the right Dir

It does give any error It print son screen as if is replacing
then brings me back to the prompt.
I'm using Sco Openserve 5.04

txs

I understand now.

what your doing is

sed -e 's/D/walter/g' CD*

which replaces the D with Walter in each file. The ouput is going to the screen to so the files themselves are unaffected.

You need to redirect the output to a new file name.

The bit of code that I put up before, in your last message should do the trick.

Do I have to write a script or type it as a command

my CD* files are in /u1/walter

I have tried runnin' it as ./ask (ASK been script name)

command line does not work and script cann't execute

txs

If you have multiple CD* files ie CD1, CD2 CD3...and you want to make this substitution for all instances (which I guess you do from your question)... then you should use a for loop. you can do this from a script or a command line. I'd suggest script so that you can run it again...or modify it for later use.

#!/usr/bin/ksh

for files in /u1/walter/CD*
do
sed -e 's/D/walter/g' $files > temp_file
mv temp_file $files
done

This will take each file in the /u1/walter directory that starts with CD make the substitution to the file and direct the output to a file called temp_file. It will then rename the temp_file to be the origianl filename.

To allow execution change the permissions on the file using chmod 755 ask. Then run as you have tried with ./ask

Hope this helps. (the -e syntax is probably optional in the sed command if you are only using one substitution).