2 removed misleading tags (Q is not about any of them specifically)
| link
1
source | link

Search and replace multiple strings in a script using vim(search and replace) commands without sed?

A script that creates a file for weather precipitation is,

#!/bin/ksh

x=10
b=snow
c=rain
d=snow
e=hail
echo "$x,$b,$c,$d,$e" > weatherfile

exit 0

given

3,8s/snow/dry/g

For the search and replace, what is the best way to implement this in a script?

From the command perspective would sed be necessary?

My thoughts are that the following should work:

sed 3,8s/snow/dry/g weatherfile

Though what if sed could not be used. Would I need to open and close the file and some how run

:3,8s/snow/dry/g while the file is open? How can this be implemented?