The Utilities>BeanShell>Evaluate For Selected Lines command evaluates the specified BeanShell expression for each selected line, replacing the contents of that line with the return value of the expression.

For example, you can use this to add a line number to each selected line, by evaluating the following expression:

(index+1) + " " + text

Or you can add a prefix and suffix to each selected line, with this expression:

"<listitem>" + text + "</listitem>"