A script that creates a file for weather precipitation is, #!/bin/kshx=10b=snowc=raind=snowe=hailecho $x,$b,$c,$d,$e > weatherfileexit 0given3,8s/snow/dry/gFor 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 weatherfileThough 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?
Search and replace multiple strings in a script using vim(search and replace) commands without sed?
text processing;sed
You can use vim commands directly with a here-document (that is especially useful for irregular replacements):#!/bin/kshvim weatherfile <<EOF:3,8s/snow/dry/g:wqEOF