rename phrase in content of file with filename - TechRepublic
Question
January 8, 2013 at 08:33 PM
ptoomen

rename phrase in content of file with filename

by ptoomen . Updated 13 years, 5 months ago

Is it possible to replace a certain phrase in the content of multiple files with the name of that file?
Eg: I have 3 files. the phrase i want to replace inside each file content is “facebook”. i want to replace it with the filename at all occurrences. Is it possible? How to do it?

eg: suppose file names are hydrogen.txt, helium.txt, oxygen.txt and all have the following content:
i love facebook. its just great. i love facebook
facebook is awesome.

after the operation, the file “hydrogen.txt” will have the following content
i love hrdrogen. its just great. i love hydrogen
hydrogen is awesome.

number of file i have is actually over a 100

This discussion is locked

All Comments