To make the .+ in your grep -Po command non-greedy (i.e., match as little as possible), you need to add a ? after the + quantifier.
.+
grep -Po
?
+
Change your pattern to:
grep -Po '.+?(?=\t+zip$)' file
.+?
(?=\t+zip$)
This ensures that the match stops at the first occurrence of \t+zip$ rather than the last.
\t+zip$
This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.
Vibe can make mistakes. Check answers. Learn more
This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.
Vibe can make mistakes. Check answers. Learn more