replace text

Hello

I'm trying to replace in a text file the chain by 107,192,196,207 107.207 but I can not

I tried the following

cat translator_swift.properties.in_modif | sed 's/107\,207/107,192,196,207/g' > translator_swift.properties.in_modif

Can you help me? thanks

I am confused. What is the target string to replace, and what is the replacement.

No need for cat, put file on end of sed command line before shell stdout redirect.

Must make new file, sed is not vi.

Sorry

the text that I want change is

107.207
by
107,192,196,207

this change I have to do in several files and want to do it automatically, searching and replacing.

With "cat" works, look

**DEV** properties $ grep EXT_HOST_ADDR sandbox.cfg
EXT_HOST_ADDR=22.34.43.14
**DEV** properties $ cat sandbox.cfg | sed 's/EXT_HOST_ADDR=22.34.43.14/EXT_HOST_ADDR=adgmm101/g' > sandbox.cfg
**DEV** properties $ grep EXT_HOST_ADDR sandbox.cfg
EXT_HOST_ADDR=adgmm101

Are you trying to change every
107.207
to
107,192,196,207
??

For example:
original myfile.txt

val=106.209
val=107.207
val=109,153,202,199

to myfile.txt

val=106.209
val=107,192,196,207
val=109,153,202,199

107,207 by 107,192,196,207
, are comma

[quote="nonanov,post:3,topic:290812"]

This is very very dangerous. The >sandbox.cfg overwrites sandbox.cfg entirely, and doesn't wait for sed to finish reading before it does so! If sed doesn't read in the entire file before the shell truncates it, much or all of it could be lost! That's probably what's happening when you don't use cat. With the cat, it takes a fraction of a second longer, giving sed a chance to read at least some of it (but NOT guaranteed to be all of it).

If you have Linux, you can use sed -i '/expression/' filename to safely edit the file "in place". It creates a temp file, then replaces filename with the temp file.

If you don't, you have to use a temp file yourself:

sed '/expression/' < input >/tmp/$$
# 'cat' is better than 'mv' since it won't alter input's ownership or permissions
cat /tmp/$$ >input
rm /tmp/$$

I hate to think we are some lingual warp with by and to. My third line was the most important,

sed 's/old/new/g' file1 > file2

. comma is not meta but dot is.

thanks,

I tested the code of Corona 688 and it works, how do I do it in multiple files? With a find?

i think that not work well when i use "cat",

With code of DGPickett , also works well

and soryy for my english

PD: i have Unix

 
find . . . | while read f
do
 sed '...' $f >$f.new
done

We all speak computa heyah!