diff --git a/helpers/generate_common.sh b/helpers/generate_common.sh
index 58bb6f250beb1c5b7cc661333ff4f7539b8da629..d500e28d20d3af4096d23aa30b79e154ce516cd2 100644
--- a/helpers/generate_common.sh
+++ b/helpers/generate_common.sh
@@ -75,7 +75,7 @@ updater_ng_repodetect() {
 	local REPO="$1"
 	local BOARD="${2:-mox}"
 	local VERSION="$(curl "https://repo.turris.cz/$REPO/packages/$BOARD/turrispackages/Packages" | \
-		awk '/^Package: updater-ng$/,/^$/ ^^ $1 == "Version:" { gsub(/-.*$/,"",$2); print $2 }')"
+		awk '/^Package: updater-ng$/,/^$/ { if ($1 == "Version:") { gsub("-.*$","",$2); print $2 } }')"
 	if [ -z "$VERSION" ]; then
 		echo "Detection of updater-ng version from repository failed. Using $UPDATER_VERSION instead."
 	else