By the way, if you've been following the recent Scala series I'm doing, you might want to be able to copy and paste the example code. For one-liners, it's a no brainer; but in the multi-line examples like this one, I tend to put in the | that the interpreter would to give some experience of continuity with what the user would see:
scala> 3 match { | case 1 => "One" | case 2 => "Two" | case 3 => "Three" | case 4 => "Many" | }
Rather than doing a bunch of work to get rid of the | from the example you copied and pasted, you can use a sed command to do this automatically:
sed -e "s/|//g"
This takes in an input, and then gets rid of all the | for you. If you're on a Mac (who isn't?) then you can even use pbpaste and pbcopy to do everything in one go:
pbpaste | sed "-e s/|//g" | pbcopy
So, to copy these examples; highlight the set of text, copy, run the script, and then paste into your Scala interpreter window. If there's any other ways of doing this programatically on Linux, let me know and I'll update this; for Windows, you can get sed via installing Cygwin.