Skip to main content
Share Your Experience: Take the 2024 Developer Survey
3 votes

How to extract a text in between two patterns (potentially containing floating lookbehind) with only one invocation?

Use reset operator: \K $ echo 'xxx "yyy zzz"' | grep -Po 'xxx\s+"\K.*?(?=\s)' yyy
Toto's user avatar
  • 18k

Only top scored, non community-wiki answers of a minimum length are eligible