Grep for Two or More Expressions
Unfortunately a database of mine crashed. Fortunately, I have log files with the data. I need the timestamp and the data.
The lines in the log files look something like this:
####### collect $TIMESTAMP ######### *GARBAGE *GARBAGE *GARBAGE $ID:=$DATASET *GARBAGE
It's been years since I've done anything more than a simple grep. I wasn't even sure which grep I needed... egrep? fgrep? grep?
I can use this regex for the timestamp line:
```bash
I can use this regex for the dataset line:
```bash
But how can I put them together? It's probably of no surpise that I can use the '|' operator like so:
```bash
Are you a Git user? Let me help you make project management with Git simple. Checkout Gitpilot.
That's it! Follow me on Twitter @jprichardson and read my blog on entrepreneurship.
-JP
comments powered by Disqus