1.

Solve : Need Help: How to replace Text string on File?

Answer»

Hi,

I need to Replace a TEXT on file and save it to another FILENAME. I know this can be done in the aplication it self "Replace". But ex. if you need 100 same file just different filename and you will just need to replace a text or "name" in a file.

ex. Need to replace "1" with "A"

Filename "1.txt"
2 3 4 1 2 3 1
1 2 3 4 5 6 7 8 9 1

and save this to diffrent filename "A.txt"
Quote from: jik on April 01, 2009, 05:37:19 AM

Hi,

I need to Replace a text on file and save it to another filename. I know this can be done in the aplication it self "Replace". But ex. if you need 100 same file just different filename and you will just need to replace a text or "name" in a file.

ex. Need to replace "1" with "A"

Filename "1.txt"
2 3 4 1 2 3 1
1 2 3 4 5 6 7 8 9 1

and save this to diffrent filename "A.txt"


if you are able to download stuffs, you can use SED (check my sig for link).
Example for 1 file
Code: [Select]c:\test> sed -i "s/1/A/g" file
2 3 4 A 2 3 A
A 2 3 4 5 6 7 8 9 A
example file multiple files
Code: [Select]c:\test> sed -i "s/1/A/g" file*.txt


what is "sed"?Quote from: jik on April 01, 2009, 06:50:14 AM
what is "sed"?
doesn't take much time to look it upQuote from: ghostdog74 on April 01, 2009, 06:54:03 AM
doesn't take much time to look it up

What he sed



Discussion

No Comment Found