In the previous example, we used read to read all the standard input in one go. But as we saw with files, reading everything into memory in one gulp often isn’t the best idea, especially when our input begins to grow in size.
It was also annoying in the previous example that we had to type ruby to-uppercase.rb. Other commands are short and snappy—cut, grep—but we had to type what feels like a lot of superfluous information.
For our next example, we’re going to write a script that extracts URLs from the input passed to it, outputting any that it finds and ignoring the rest of the input. So, if we passed it the following text:
Alice's website is at http://www.example.com
While Jane's website is at https://example.net ...