STEP 1. Press CTRL-H to bring up the Find/Replace Dialog.
STEP 2. Choose the “Regular expressions” checkbox near the bottom of the dialog.
STEP 3.a To add “test” to the beginning of each line, type `^` in the “Find what” field, and “test” in the “Replace with” field. Then hit “Replace All”.
STEP 3.b To add “test” to the end of each line, type `$` in the “Find what” field, and “test” in the “Replace with” field. Then hit “Replace All”.