How can I grep for two values from the same input being piped to it?

view story

http://serverfault.com – CentOS 5.x I'm trying to build a shell script that searches data provided via stdin. Here's an example of the input stream: Date: 1/1/11 Time: 12:00 AM Foo: 12345 Foo1: dskjflsdkjflksdjlfds Foo2: 123456789 Foo3: kdsjflskdjflkjsdlkfjsdlkjflksdjflkjsdklfjlksdjflk This information doesn't exist in a file, it would only be sent to the script in real-time as stdout from another app. I want the sript to look at the data and parse out the values for Foo: and Foo2: storing those as variables for use later in the script. My revised script attempt is this: #!/bin/bash while read data; do (HowTos)