sed -i not available in solaris 5.10

view story

http://www.unix.com – Hi All, i'm writing a script where i have to grep for a pattern and the 3 lines after the pattern and comment them out. Note that i have to do this for multiple files, i am able to grep the pattern and the next 3 lines but since solaris does not recognize the -i option, i was wondering if there was any workaround. sample file: Code: cat list.txt ... ... ... Hello world how r u whats up .... .... ... [... represent randon text in the file which is not relevant ] Code: vi pattern.sh cat list.txt | while read line do pattern=$(awk '/hello/{x=NR+2}(NR<=x){print}' $l (HowTos)