curl_examples: Refactor testing code.
curl_examples: Refactor testing code.

This commit refactors the code to find the
lines to be first, and then test all the
lines that contained commands.

This was done to avoid duplication of
the code for the other case, where the
.md file won't exist, as those are soon
to be deleted in favour of a common template.

hackerkid/zulip,hackerkid/zulip,punchagan/zulip,eeshangarg/zulip,kou/zulip,kou/zulip,punchagan/zulip,zulip/zulip,eeshangarg/zulip,rht/zulip,rht/zulip,hackerkid/zulip,zulip/zulip,andersk/zulip,andersk/zulip,kou/zulip,zulip/zulip,hackerkid/zulip,eeshangarg/zulip,andersk/zulip,kou/zulip,andersk/zulip,andersk/zulip,zulip/zulip,rht/zulip,andersk/zulip,zulip/zulip,punchagan/zulip,kou/zulip,rht/zulip,andersk/zulip,punchagan/zulip,eeshangarg/zulip,hackerkid/zulip,eeshangarg/zulip,kou/zulip,zulip/zulip,rht/zulip,kou/zulip,eeshangarg/zulip,rht/zulip,punchagan/zulip,punchagan/zulip,punchagan/zulip,eeshangarg/zulip,rht/zulip,zulip/zulip,hackerkid/zulip,hackerkid/zulip