Find all files in the current directory (denoted by ~/*) with a maximum depth of 0 and a name ending in ".txt", and execute the command "sed -i 's/foo/bar/g' {} +" on each of them.
find ~/* -maxdepth 0 -name "*.txt" -exec sed -i 's/foo/bar/g' {} +