-1

I have the following problem: I have a huge file and i have to replace some value (more than one).

Ad example, I have to replace:

DOG with RED
CAT with BLUE
FISH with GREEN
...

...
n    with N

Do you know some software that is able (putting in input a list value) to replace all the value of the list in one hit in the text?

EDIT:

My text file is something really big as a book or similar. In this book i have many words that i have to replace with other words

Vito
  • 746
  • 2
  • 9
  • 25

1 Answers1

0

You can use sed to substitute matching expressions, for example

sed -e 's/DOG/RED/g;s/CAT/BLUE/g' < inputFile > outputFile

You haven't specified if you wan this changed in place or not. You could clearly delete the old version afterwards if you were happy with the results.

..... If you are on Windows some other answers will give you an equivalent or suggest tools such as cygwin: e.g. here

Community
  • 1
  • 1
doctorlove
  • 18,872
  • 2
  • 46
  • 62