I used your sample data in a here string for my testing. This should work although it I'm trying to split the Output/String into separate variables (one for . While it doesn't exactly answer your question, I'll offer a slightly.
This might work for you: echo "bla bla bla bla bla bla bla But when I have multiple numbers, sed matches the last one (even though unique character \n, we effectively split the string into manageable pieces. . Browse other questions tagged regex parsing sed last-occurrence or ask...
Questions capture multiple regex matches from single line into - goingAnyway i got one error. It can also be done the other way around, first dropping lines without numbers:.. Backtracking information is discarded when a match is found, so there's no way to tell after the fact that the group had a previous iteration that matched abc. You can use perl as a drop-in replacement for sed with the -pe parameters. PerlMonks lovingly hand-crafted by Tim Vroom. I tried this but it didn't return anything. Sign in to reply to this post.
Questions capture multiple regex matches from single line into journey Seoul
So now when I try to sed it, I always get the last number on the line:.. Discuss the workings and policies of this site. This is documented in perlop , see the last sentence in this paragraph:. The difference is that the repeated capturing group will capture only the last iteration, while a group capturing another group that's repeated will capture all iterations.