I would like the sed equivalent to: grep -Eo 'regex'. I might, hypothetically, want to do further work with the output. This step might be just the first part of something that will be more elaborate by adding ; s… to a longer sed expression.
To be clearer, I want to be able to isolate each string matching a given regular expression in an input stream. For proof-of-concept purposes, each such string should be output as a separate line with no context (i.e., no surrounding text from the input). So an input line with multiple (non-overlapping) matches should result in multiple output lines; an input line with no matches should result in no output.
Example:
Regular expression: [a-zA-Z]{3}[0-9]{4} (i.e., three letters followed by four digits)
Input:
FGH1234 and CAS4057 MAX2345 Output:
FGH1234 CAS4057 MAX2345
grepif it does what you want?