|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
batch search/replace in one file according to an external file
Hi there,
Is sed the right tool to achieve the following: Search & replace one single text file according to an external "replace.txt" file that contains the replacement patterns. Something like this: "blau" <TAB> "blue"<CR> "rot" <TAB> "red"<CR> "weiss" <TAB> "white"<CR> ... So that I have the search/replace terms stored in an external file. Hope I made myself clear..? ![]() I've read about sed's capability to batch search & replace on multiple files but nothing about batch replacing in a single file. thanks for any help/info on this |
|
#2
|
|||
|
|||
|
Use one invocation of sed to transform your replace.txt file into a bunch of sed statements like:
s/blau/blue/g Then feed that new file into a second sed invocation that uses the -f option to read sed commands from the new file. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > batch search/replace in one file according to an external file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|