views:

45

answers:

1

Is it possible using a batch script to change string in a txt file?

For example, I have status.txt, which contains 2 lines:

SingleSite integer1
MultiSite  integer2

I want to change them into:

TAG  integer1
Engineer integer2 

so SingleSite becomes TAG and MultiSite becomes Engineer

A: 

sed -e "s/SingleSite/TAG/g" status.txt > new.status.txt using one of the ports of sed mentioned in the article in Helen's comment.

Stephen P