GNU's grep has the option --only-matching
, which prints just the matching region of a regular expression. I'm on a Solaris 5.10 box without any GNU tools installed, and I'm trying to achieve the same thing. Example:
grep -Eo "[0-9]+ ms" *.log
Is there a sed or awk expression that can do the same thing?