What about simply adding a q command after the first replacement so only that one is handled?

I don't know how to do, my sed skills are still on a beginner level and I guess this will remain so :).
Tried: sed -e 's/^\( *version: *\)[^,]*\(,\)/\1'"\'$VER\'"'\2/;q' -i meson.build
but then sed stops any processing directly after the first line and since we modify the file inline, meson.build only has its first line left.

Then I tried: sed -e 's/^\( *version: *\)[^,]*\(,\)/\1'"\'$VER\'"'\2/1' -i meson.build
which should, to my understanding, replace only the first match of the regex and then stop. In my tests, it replaced multiple matches anyway.

After all, I think this is a rather small problem and once it occurs, we can handle it. Again, it is only the version-bump script.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/pull/3599/c1763322023@github.com>