Using sed in bash for loop

Will replace string hello with bye in all .txt files in current directory:

for txtfile in *.txt; do sed -i 's/hello/bye/g' $txtfile; done