Your original script was on the right lines, but too complicated:
echo -e "foo\n-- \nbar" | gawk '/^--\ / { x++ } { if (x==0) print}'
Variables are automatically created and nullified by awk (so you don't need -vx=0 , etc.). The code "spot the double dash" was fine. A half-column is not needed (at best). IF (x == 0) {print} looks weird. awk on Mac OS X 10.7.5 accepts this, but I'm not sure what it does. The replace action for each line also checks if x zero before printing.
Personally, I would use sed for this:
echo -e "foo\n-- \nbar" | sed '/^--/q'
Committing my sed command as gniourf_gniourf suggests :
echo -e "foo\n-- \nbar" | sed -n '/^--/q;p'
You can imitate this in awk with the sputnick command in the answer.
echo -e "foo\n-- \nbar" | awk '/^--/ {exit} 1'
1 corresponds to each line (it is always true) and triggers the default action, which is "print $ 0". You can also write:
echo -e "foo\n-- \nbar" | awk '/^--/ {exit} {print}'
source share