Skip to main content
The 2024 Developer Survey results are live! See the results
Active reading.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 109
  • 132

How tocan I output only captured groups with sed?

Is there anya way to tell sed to output only captured groups? 

For example, given the input:

This is a sample 123 text and some 987 numbers

andAnd pattern:

/([\d]+)/

Could I get only 123 and 987 output in the way formatted by back references?

How to output only captured groups with sed?

Is there any way to tell sed to output only captured groups? For example given the input:

This is a sample 123 text and some 987 numbers

and pattern:

/([\d]+)/

Could I get only 123 and 987 output in the way formatted by back references?

How can I output only captured groups with sed?

Is there a way to tell sed to output only captured groups? 

For example, given the input:

This is a sample 123 text and some 987 numbers

And pattern:

/([\d]+)/

Could I get only 123 and 987 output in the way formatted by back references?

Specifying that code sample is just text.
Source Link
Jaime Hablutzel
  • 6.3k
  • 6
  • 41
  • 60

Is there any way to tell sed to output only captured groups? For example given the input:

This is a sample 123 text and some 987 numbers
This is a sample 123 text and some 987 numbers

and pattern:

/([\d]+)/

Could I get only 123 and 987 output in the way formatted by back references?

Is there any way to tell sed to output only captured groups? For example given the input:

This is a sample 123 text and some 987 numbers

and pattern:

/([\d]+)/

Could I get only 123 and 987 output in the way formatted by back references?

Is there any way to tell sed to output only captured groups? For example given the input:

This is a sample 123 text and some 987 numbers

and pattern:

/([\d]+)/

Could I get only 123 and 987 output in the way formatted by back references?

edited tags
Link
Mateusz Piotrowski
  • 8.7k
  • 10
  • 57
  • 81

How to output only captured groups with sed?

deleted 4 characters in body; edited title
Source Link
Air
  • 8.5k
  • 2
  • 54
  • 88
Loading
Source Link
Pablo
  • 29.1k
  • 35
  • 131
  • 220
Loading