To find a list of files in the current directory (including subdirectories) that contain certain strings, use this > rgrep -l -R '*.scm' SayPhones . will (l)ist the filenames (among .scm files) containing the string "SayPhones" recursively in the current directory. To replace a letter with a "return key" in a query-replace in Emacs: > ESC-% > type a letter to be replace with > CTRL-Q, CTRL-J (Ctrl-Q for "take this literally", and Ctrl-J for "return key")